示例#1
0
 public MTFiniteTimeActionState(MTFiniteTimeAction action, GameObject target)
     : base(action, target)
 {
     Duration = action.Duration;
     Elapsed = 0.0f;
     firstTick = true;
 }
示例#2
0
 public MTFiniteTimeActionState(MTFiniteTimeAction action, GameObject target)
     : base(action, target)
 {
     Duration = action.Duration;
     Elapsed = 0.0f;
     firstTick = true;
 }
示例#3
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]);
            }
        }
示例#4
0
 public static MTActionState RepeatForever(this GameObject target, MTFiniteTimeAction action)
 {
     return(target.RunAction(new MTRepeatForever(action)
     {
         Tag = action.Tag
     }));
 }
示例#5
0
        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);
            }
        }
示例#6
0
        void InitMTSequence(MTFiniteTimeAction actionOne, MTFiniteTimeAction actionTwo)
        {
            Debug.Assert (actionOne != null);
            Debug.Assert (actionTwo != null);

            Actions [0] = actionOne;
            Actions [1] = actionTwo;
        }
示例#7
0
        void InitMTSequence(MTFiniteTimeAction actionOne, MTFiniteTimeAction actionTwo)
        {
            Debug.Assert(actionOne != null);
            Debug.Assert(actionTwo != null);

            Actions [0] = actionOne;
            Actions [1] = actionTwo;
        }
示例#8
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);
        }
示例#9
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));
        }
示例#10
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;
        }
示例#11
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;
        }
示例#12
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));
            }
        }
示例#13
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));
            }
        }
示例#14
0
 public MTRepeatForever(MTFiniteTimeAction action)
 {
     Debug.Assert(action != null);
     InnerAction = action;
 }
示例#15
0
 public MTEaseCubicInOut(MTFiniteTimeAction action) : base(action)
 {
 }
示例#16
0
 public MTReverseTime(MTFiniteTimeAction action) : base(action.Duration)
 {
     Other = action;
 }
示例#17
0
 public MTRepeatForever(MTFiniteTimeAction action)
 {
     Debug.Assert (action != null);
     InnerAction = action;
 }
示例#18
0
 public MTEaseCustom(MTFiniteTimeAction action, Func<float, float> easeFunc)
     : base(action)
 {
     EaseFunc = easeFunc;
 }
示例#19
0
 public MTEaseElasticIn(MTFiniteTimeAction action)
     : this(action, 0.3f)
 {
 }
示例#20
0
 public MTSpeed(MTFiniteTimeAction action, float speed)
 {
     InnerAction = action;
     Speed = speed;
 }
示例#21
0
 public MTActionEase(MTFiniteTimeAction action)
     : base(action.Duration)
 {
     InnerAction = action;
 }
示例#22
0
 public MTSpeed(MTFiniteTimeAction action, float speed)
 {
     InnerAction = action;
     Speed       = speed;
 }
示例#23
0
 public MTEaseInOut(MTFiniteTimeAction action, float rate)
     : base(action, rate)
 {
 }
示例#24
0
 public MTEaseCustom(MTFiniteTimeAction action, Func <float, float> easeFunc) : base(action)
 {
     EaseFunc = easeFunc;
 }
示例#25
0
 public MTEaseQuadIn(MTFiniteTimeAction action) : base(action)
 {
 }
示例#26
0
 public MTEaseQuartOut(MTFiniteTimeAction action) : base(action)
 {
 }
示例#27
0
 public MTEaseIn(MTFiniteTimeAction action, float rate) : base(action, rate)
 {
 }
示例#28
0
 public MTEaseSineIn(MTFiniteTimeAction action) : base(action)
 {
 }
示例#29
0
 public MTEaseElastic(MTFiniteTimeAction action, float period)
     : base(action)
 {
     Period = period;
 }
示例#30
0
 public MTTargetedAction(GameObject target, MTFiniteTimeAction action)
     : base(action.Duration)
 {
     ForcedTarget = target;
     TargetedAction = action;
 }
示例#31
0
 public static MTActionState Repeat(this GameObject target, uint times, MTFiniteTimeAction action)
 {
     return  target.RunAction (new MTRepeat (action, times));
 }
示例#32
0
 public MTEaseRateAction(MTFiniteTimeAction action, float rate)
     : base(action)
 {
     Rate = rate;
 }
示例#33
0
 public static MTActionState RepeatForever(this GameObject target, MTFiniteTimeAction action)
 {
     return target.RunAction(new MTRepeatForever (action) { Tag = action.Tag });
 }
示例#34
0
 public MTSequence(MTFiniteTimeAction action1, MTFiniteTimeAction action2)
     : base(action1.Duration + action2.Duration)
 {
     Actions = new MTFiniteTimeAction[2];
     InitMTSequence (action1, action2);
 }
示例#35
0
 public MTEaseElasticInOut(MTFiniteTimeAction action) : this(action, 0.3f)
 {
 }
示例#36
0
 public MTEaseSineIn(MTFiniteTimeAction action)
     : base(action)
 {
 }
示例#37
0
 public MTEaseElasticInOut(MTFiniteTimeAction action, float period) : base(action, period)
 {
 }
示例#38
0
 public MTEaseExponentialInOut(MTFiniteTimeAction action)
     : base(action)
 {
 }
示例#39
0
 protected MTSpawn(MTFiniteTimeAction action1, MTFiniteTimeAction action2)
     : base(Math.Max(action1.Duration, action2.Duration))
 {
     InitMTSpawn(action1, action2);
 }
示例#40
0
 public MTRepeatForever(params MTFiniteTimeAction[] actions)
 {
     Debug.Assert(actions != null);
     InnerAction = new MTSequence(actions);
 }
示例#41
0
 public MTEaseElasticOut(MTFiniteTimeAction action) : base(action, 0.3f)
 {
 }
示例#42
0
 public MTEaseExponentialOut(MTFiniteTimeAction action) : base(action)
 {
 }
示例#43
0
 public MTEaseRateAction(MTFiniteTimeAction action, float rate) : base(action)
 {
     Rate = rate;
 }
示例#44
0
 public MTReverseTime(MTFiniteTimeAction action)
     : base(action.Duration)
 {
     Other = action;
 }
示例#45
0
 public MTEaseQuintInOut(MTFiniteTimeAction action) : base(action)
 {
 }
示例#46
0
 public MTEaseCircOut(MTFiniteTimeAction action) : base(action)
 {
 }
示例#47
0
 public MTEaseBackIn(MTFiniteTimeAction action) : base(action)
 {
 }
示例#48
0
 public MTSequence(MTFiniteTimeAction action1, MTFiniteTimeAction action2) : base(action1.Duration + action2.Duration)
 {
     Actions = new MTFiniteTimeAction[2];
     InitMTSequence(action1, action2);
 }
示例#49
0
 public MTActionEase(MTFiniteTimeAction action) : base(action.Duration)
 {
     InnerAction = action;
 }
示例#50
0
 public MTEaseBackIn(MTFiniteTimeAction action)
     : base(action)
 {
 }
示例#51
0
 public static MTActionState Repeat(this GameObject target, uint times, MTFiniteTimeAction action)
 {
     return(target.RunAction(new MTRepeat(action, times)));
 }
示例#52
0
 public MTEaseElasticIn(MTFiniteTimeAction action, float period)
     : base(action, period)
 {
 }
示例#53
0
 public MTEaseBounceIn(MTFiniteTimeAction action) : base(action)
 {
 }
示例#54
0
 public MTEaseBounceInOut(MTFiniteTimeAction action)
     : base(action)
 {
 }
示例#55
0
 protected MTSpawn(MTFiniteTimeAction action1, MTFiniteTimeAction action2)
     : base(Math.Max (action1.Duration, action2.Duration))
 {
     InitMTSpawn (action1, action2);
 }