Пример #1
0
        public bool InitWithTwoActions(IFiniteTimeAction action1, IFiniteTimeAction action2)
        {
            if (action1 == null || action2 == null)
            {
                this.LogError("initWithTwoActions action is null!!");
            }
            bool ret = false;
            var  d1  = action1.Duration;
            var  d2  = action2.Duration;

            if (base.InitWithDuration(Math.Max(d1, d2)))
            {
                m_one = action1;
                m_two = action2;
                if (d1 > d2)
                {
                    m_two = CCActionSequence.CreateWithTwoActions(action2, CCActionDelay.Create(d1 - d2));
                }
                else if (d1 < d2)
                {
                    m_one = CCActionSequence.CreateWithTwoActions(action1, CCActionDelay.Create(d2 - d1));
                }
                ret = true;
            }
            return(ret);
        }
Пример #2
0
        public static CCActionSequence CreateWithTwoActions(IFiniteTimeAction actionOne, IFiniteTimeAction actionTwo)
        {
            CCActionSequence sequence = new CCActionSequence();

            if (sequence != null && sequence.InitWithTwoActions(actionOne, actionTwo))
            {
                return(sequence);
            }
            return(null);
        }
Пример #3
0
        public static CCActionRepeat Create(IFiniteTimeAction action, uint times)
        {
            CCActionRepeat repeat = new CCActionRepeat();

            if (repeat.InitWithAction(action, times))
            {
                return(repeat);
            }
            return(null);
        }
Пример #4
0
        public static CCActionSpawn CreateWithTwoActions(IFiniteTimeAction actionOne, IFiniteTimeAction actionTwo)
        {
            CCActionSpawn spawn = new CCActionSpawn();

            if (spawn != null && spawn.InitWithTwoActions(actionOne, actionTwo))
            {
                return(spawn);
            }
            return(null);
        }
Пример #5
0
 public bool InitWithAction(IFiniteTimeAction action, uint times)
 {
     if (action != null && base.InitWithDuration(action.Duration * times))
     {
         this.m_times       = times;
         this.m_innerAction = action;
         m_actionInstant    = action is CCActionExecute;
         m_total            = 0;
         return(true);
     }
     return(false);
 }
Пример #6
0
        public bool InitWithTwoActions(IFiniteTimeAction actionOne, IFiniteTimeAction actionTwo)
        {
            if (actionOne == null || actionTwo == null)
            {
                this.LogError("InitWithTwoActions action is null");
            }
            float d = actionOne.Duration + actionTwo.Duration;

            base.InitWithDuration(d);
            m_actions[0] = actionOne;
            m_actions[1] = actionTwo;
            return(true);
        }
Пример #7
0
        public static CCActionSequence Create(IFiniteTimeAction action1, params IFiniteTimeAction[] args)
        {
            IFiniteTimeAction now;
            IFiniteTimeAction prev = action1;

            for (int i = 0; i < args.Length; i++)
            {
                now  = args[i];
                prev = CreateWithTwoActions(prev, now);
            }
            if (args.Length == 0)
            {
                prev = CreateWithTwoActions(prev, ExtraAction.Create());
            }
            return(prev as CCActionSequence);
        }