Ejemplo n.º 1
0
        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]);
            }
        }
Ejemplo n.º 2
0
 public MTFiniteTimeActionState(MTFiniteTimeAction action, GameObject target)
     : base(action, target)
 {
     Duration = action.Duration;
     Elapsed = 0.0f;
     firstTick = true;
 }
Ejemplo n.º 3
0
        void InitMTSequence(MTFiniteTimeAction actionOne, MTFiniteTimeAction actionTwo)
        {
            Debug.Assert (actionOne != null);
            Debug.Assert (actionTwo != null);

            Actions [0] = actionOne;
            Actions [1] = actionTwo;
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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;
        }
Ejemplo n.º 6
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));
            }
        }
Ejemplo n.º 7
0
 public MTEaseExponentialInOut(MTFiniteTimeAction action)
     : base(action)
 {
 }
Ejemplo n.º 8
0
 public MTTargetedAction(GameObject target, MTFiniteTimeAction action)
     : base(action.Duration)
 {
     ForcedTarget = target;
     TargetedAction = action;
 }
Ejemplo n.º 9
0
 public MTEaseSineIn(MTFiniteTimeAction action)
     : base(action)
 {
 }
Ejemplo n.º 10
0
 public MTSequence(MTFiniteTimeAction action1, MTFiniteTimeAction action2)
     : base(action1.Duration + action2.Duration)
 {
     Actions = new MTFiniteTimeAction[2];
     InitMTSequence (action1, action2);
 }
Ejemplo n.º 11
0
 public static MTActionState RepeatForever(this GameObject target, MTFiniteTimeAction action)
 {
     return target.RunAction(new MTRepeatForever (action) { Tag = action.Tag });
 }
Ejemplo n.º 12
0
 public static MTActionState Repeat(this GameObject target, uint times, MTFiniteTimeAction action)
 {
     return  target.RunAction (new MTRepeat (action, times));
 }
Ejemplo n.º 13
0
 public MTEaseCustom(MTFiniteTimeAction action, Func<float, float> easeFunc)
     : base(action)
 {
     EaseFunc = easeFunc;
 }
Ejemplo n.º 14
0
 public MTEaseElasticIn(MTFiniteTimeAction action, float period)
     : base(action, period)
 {
 }
Ejemplo n.º 15
0
 public MTEaseBackIn(MTFiniteTimeAction action)
     : base(action)
 {
 }
Ejemplo n.º 16
0
 public MTEaseRateAction(MTFiniteTimeAction action, float rate)
     : base(action)
 {
     Rate = rate;
 }
Ejemplo n.º 17
0
 public MTEaseInOut(MTFiniteTimeAction action, float rate)
     : base(action, rate)
 {
 }
Ejemplo n.º 18
0
 public MTEaseElastic(MTFiniteTimeAction action, float period)
     : base(action)
 {
     Period = period;
 }
Ejemplo n.º 19
0
 public MTReverseTime(MTFiniteTimeAction action)
     : base(action.Duration)
 {
     Other = action;
 }
Ejemplo n.º 20
0
 public MTSpeed(MTFiniteTimeAction action, float speed)
 {
     InnerAction = action;
     Speed = speed;
 }
Ejemplo n.º 21
0
 public MTRepeatForever(MTFiniteTimeAction action)
 {
     Debug.Assert (action != null);
     InnerAction = action;
 }
Ejemplo n.º 22
0
 public MTEaseElasticIn(MTFiniteTimeAction action)
     : this(action, 0.3f)
 {
 }
Ejemplo n.º 23
0
 public MTActionEase(MTFiniteTimeAction action)
     : base(action.Duration)
 {
     InnerAction = action;
 }
Ejemplo n.º 24
0
 public MTEaseBounceInOut(MTFiniteTimeAction action)
     : base(action)
 {
 }
Ejemplo n.º 25
0
 protected MTSpawn(MTFiniteTimeAction action1, MTFiniteTimeAction action2)
     : base(Math.Max (action1.Duration, action2.Duration))
 {
     InitMTSpawn (action1, action2);
 }