public MTFiniteTimeActionState(MTFiniteTimeAction action, GameObject target) : base(action, target) { Duration = action.Duration; Elapsed = 0.0f; firstTick = true; }
public MTSequence(params MTFiniteTimeAction[] actions) : base() { Actions = new MTFiniteTimeAction[2]; var prev = actions [0]; // Can't call base(duration) because we need to calculate duration here float combinedDuration = 0.0f; for (int i = 0 ; i < actions.Length; ++i) { var action = actions[i]; combinedDuration += action.Duration; } Duration = combinedDuration; if (actions.Length == 1) { InitMTSequence (prev, new MTExtraAction ()); } else { // Basically what we are doing here is creating a whole bunch of // nested MTSequences from the actions. for (int i = 1; i < actions.Length - 1; i++) { prev = new MTSequence (prev, actions [i]); } InitMTSequence (prev, actions [actions.Length - 1]); } }
public static MTActionState RepeatForever(this GameObject target, MTFiniteTimeAction action) { return(target.RunAction(new MTRepeatForever(action) { Tag = action.Tag })); }
public MTSpawn(params MTFiniteTimeAction[] actions) { MTFiniteTimeAction prev = actions [0]; MTFiniteTimeAction next = null; if (actions.Length == 1) { next = new MTExtraAction(); } else { // We create a nested set of MTSpawnActions out of all of the actions for (int i = 1; i < actions.Length - 1; i++) { prev = new MTSpawn(prev, actions [i]); } next = actions [actions.Length - 1]; } // Can't call base(duration) because we need to determine max duration // Instead call base's init method here if (prev != null && next != null) { Duration = Math.Max(prev.Duration, next.Duration); InitMTSpawn(prev, next); } }
void InitMTSequence(MTFiniteTimeAction actionOne, MTFiniteTimeAction actionTwo) { Debug.Assert (actionOne != null); Debug.Assert (actionTwo != null); Actions [0] = actionOne; Actions [1] = actionTwo; }
void InitMTSequence(MTFiniteTimeAction actionOne, MTFiniteTimeAction actionTwo) { Debug.Assert(actionOne != null); Debug.Assert(actionTwo != null); Actions [0] = actionOne; Actions [1] = actionTwo; }
public override MTFiniteTimeAction Reverse() { MTFiniteTimeAction[] rev = new MTFiniteTimeAction[Actions.Length]; for (int i = 0; i < Actions.Length; i++) { rev [i] = Actions [i].Reverse (); } return new MTParallel (rev); }
public override MTFiniteTimeAction Reverse() { MTFiniteTimeAction[] rev = new MTFiniteTimeAction[Actions.Length]; for (int i = 0; i < Actions.Length; i++) { rev [i] = Actions [i].Reverse(); } return(new MTParallel(rev)); }
public MTRepeat(MTFiniteTimeAction action, uint times) : base(action.Duration * times) { Times = times; InnerAction = action; ActionInstant = action is MTActionInstant; //an instant action needs to be executed one time less in the update method since it uses startWithTarget to execute the action if (ActionInstant) { Times -= 1; } Total = 0; }
private void InitMTSpawn(MTFiniteTimeAction action1, MTFiniteTimeAction action2) { Debug.Assert(action1 != null); Debug.Assert(action2 != null); float d1 = action1.Duration; float d2 = action2.Duration; ActionOne = action1; ActionTwo = action2; if (d1 > d2) { ActionTwo = new MTSequence(action2, new MTDelayTime(d1 - d2)); } else if (d1 < d2) { ActionOne = new MTSequence(action1, new MTDelayTime(d2 - d1)); } }
private void InitMTSpawn(MTFiniteTimeAction action1, MTFiniteTimeAction action2) { Debug.Assert (action1 != null); Debug.Assert (action2 != null); float d1 = action1.Duration; float d2 = action2.Duration; ActionOne = action1; ActionTwo = action2; if (d1 > d2) { ActionTwo = new MTSequence (action2, new MTDelayTime (d1 - d2)); } else if (d1 < d2) { ActionOne = new MTSequence (action1, new MTDelayTime (d2 - d1)); } }
public MTRepeatForever(MTFiniteTimeAction action) { Debug.Assert(action != null); InnerAction = action; }
public MTEaseCubicInOut(MTFiniteTimeAction action) : base(action) { }
public MTReverseTime(MTFiniteTimeAction action) : base(action.Duration) { Other = action; }
public MTRepeatForever(MTFiniteTimeAction action) { Debug.Assert (action != null); InnerAction = action; }
public MTEaseCustom(MTFiniteTimeAction action, Func<float, float> easeFunc) : base(action) { EaseFunc = easeFunc; }
public MTEaseElasticIn(MTFiniteTimeAction action) : this(action, 0.3f) { }
public MTSpeed(MTFiniteTimeAction action, float speed) { InnerAction = action; Speed = speed; }
public MTActionEase(MTFiniteTimeAction action) : base(action.Duration) { InnerAction = action; }
public MTEaseInOut(MTFiniteTimeAction action, float rate) : base(action, rate) { }
public MTEaseCustom(MTFiniteTimeAction action, Func <float, float> easeFunc) : base(action) { EaseFunc = easeFunc; }
public MTEaseQuadIn(MTFiniteTimeAction action) : base(action) { }
public MTEaseQuartOut(MTFiniteTimeAction action) : base(action) { }
public MTEaseIn(MTFiniteTimeAction action, float rate) : base(action, rate) { }
public MTEaseSineIn(MTFiniteTimeAction action) : base(action) { }
public MTEaseElastic(MTFiniteTimeAction action, float period) : base(action) { Period = period; }
public MTTargetedAction(GameObject target, MTFiniteTimeAction action) : base(action.Duration) { ForcedTarget = target; TargetedAction = action; }
public static MTActionState Repeat(this GameObject target, uint times, MTFiniteTimeAction action) { return target.RunAction (new MTRepeat (action, times)); }
public MTEaseRateAction(MTFiniteTimeAction action, float rate) : base(action) { Rate = rate; }
public static MTActionState RepeatForever(this GameObject target, MTFiniteTimeAction action) { return target.RunAction(new MTRepeatForever (action) { Tag = action.Tag }); }
public MTSequence(MTFiniteTimeAction action1, MTFiniteTimeAction action2) : base(action1.Duration + action2.Duration) { Actions = new MTFiniteTimeAction[2]; InitMTSequence (action1, action2); }
public MTEaseElasticInOut(MTFiniteTimeAction action) : this(action, 0.3f) { }
public MTEaseElasticInOut(MTFiniteTimeAction action, float period) : base(action, period) { }
public MTEaseExponentialInOut(MTFiniteTimeAction action) : base(action) { }
protected MTSpawn(MTFiniteTimeAction action1, MTFiniteTimeAction action2) : base(Math.Max(action1.Duration, action2.Duration)) { InitMTSpawn(action1, action2); }
public MTRepeatForever(params MTFiniteTimeAction[] actions) { Debug.Assert(actions != null); InnerAction = new MTSequence(actions); }
public MTEaseElasticOut(MTFiniteTimeAction action) : base(action, 0.3f) { }
public MTEaseExponentialOut(MTFiniteTimeAction action) : base(action) { }
public MTEaseQuintInOut(MTFiniteTimeAction action) : base(action) { }
public MTEaseCircOut(MTFiniteTimeAction action) : base(action) { }
public MTEaseBackIn(MTFiniteTimeAction action) : base(action) { }
public MTSequence(MTFiniteTimeAction action1, MTFiniteTimeAction action2) : base(action1.Duration + action2.Duration) { Actions = new MTFiniteTimeAction[2]; InitMTSequence(action1, action2); }
public static MTActionState Repeat(this GameObject target, uint times, MTFiniteTimeAction action) { return(target.RunAction(new MTRepeat(action, times))); }
public MTEaseElasticIn(MTFiniteTimeAction action, float period) : base(action, period) { }
public MTEaseBounceIn(MTFiniteTimeAction action) : base(action) { }
public MTEaseBounceInOut(MTFiniteTimeAction action) : base(action) { }
protected MTSpawn(MTFiniteTimeAction action1, MTFiniteTimeAction action2) : base(Math.Max (action1.Duration, action2.Duration)) { InitMTSpawn (action1, action2); }