// Create the sun action controller - The sun will pulsate a bit (color and size) OTActionController SunController() { // create a new action controller OTActionController ac = new OTActionController("sun"); // Add the size and color actions ac.Add("size-up", new OTActionSize(new Vector2(205, 205), 0.25f, OTEasing.CircInOut)); ac.Add("size-down", new OTActionSize(new Vector2(200, 200), 0.25f, OTEasing.CircInOut)); ac.Add("tint-up", new OTActionTween("tintColor", new Color(1f, 1f, 1f), 0.25f, OTEasing.CircInOut)); ac.Add("tint-down", new OTActionTween("tintColor", new Color(1f, 1f, 0.5f), 0.25f, OTEasing.CircInOut)); // Add the action tree ac.Add("size", new OTActionTree().Action("size-up").And("tint-up"). FollowedBy("size-down").And("tint-down")); // run this action looping ( count = -1 ) ac.Run("size", 1, -1); return ac; }
// Create an arrow action controller - size up and fade out. OTActionController ArrowController() { // create a new action controller OTActionController ac = new OTActionController("arrow-left"); // add size and fade actions ac.Add("setSize", new OTActionSet("size", new Vector2(150, 118))); ac.Add("setAlpha", new OTActionSet("alpha", .8f)); ac.Add("sizeUp", new OTActionSize(new Vector2(150, 118) * 1.4f, .75f, OTEasing.SineOut)); ac.Add("FadeOut", new OTActionFadeOut(.75f, OTEasing.Linear)); // Add the action tree ac.Add("effect", new OTActionTree().Wait(2). FollowedBy("setSize").And("setAlpha"). FollowedBy("sizeUp").And("FadeOut")); // Run the tree looping (count - -1 ) ac.Run("effect", 1, -1); return ac; }
protected override bool Execute() { if (owner is OTObject) { OTActionController c = (owner as OTObject).Controller <OTActionController>() as OTActionController; if (c != null) { c.Stop(); } OT.DestroyObject(owner as OTObject); } else if (owner is GameObject) { OT.DestroyObject(owner as GameObject); } return(true); }