Beispiel #1
0
        protected bool InitOneTwo(CCFiniteTimeAction action1, CCFiniteTimeAction action2)
        {
            Debug.Assert(action1 != null);
            Debug.Assert(action2 != null);

            bool bRet = false;

            float d1 = action1.Duration;
            float d2 = action2.Duration;

            if (base.InitWithDuration(Math.Max(d1, d2)))
            {
                m_pOne = action1;
                m_pTwo = action2;

                if (d1 > d2)
                {
                    m_pTwo = new CCSequence (action2, new CCDelayTime (d1 - d2));
                }
                else if (d1 < d2)
                {
                    m_pOne = new CCSequence (action1, new CCDelayTime (d2 - d1));
                }

                bRet = true;
            }

            return bRet;
        }
Beispiel #2
0
 public CCParallel(CCParallel copy) : base(copy)
 {
     CCFiniteTimeAction[] cp = new CCFiniteTimeAction[copy.m_pActions.Length];
     for (int i = 0; i < copy.m_pActions.Length; i++)
     {
         cp[i] = copy.m_pActions[i].Copy() as CCFiniteTimeAction;
     }
     m_pActions = cp;
 }
Beispiel #3
0
        /// <summary>
        /// Reverses the current parallel sequence.
        /// </summary>
        /// <returns></returns>
        public override CCFiniteTimeAction Reverse()
        {
            CCFiniteTimeAction[] rev = new CCFiniteTimeAction[m_pActions.Length];
            for (int i = 0; i < m_pActions.Length; i++)
            {
                rev[i] = m_pActions[i].Reverse();
            }

            return(new CCParallel(rev));
        }
Beispiel #4
0
        /// <summary>
        /// Reverses the current parallel sequence.
        /// </summary>
        /// <returns></returns>
        public override CCFiniteTimeAction Reverse()
        {
            CCFiniteTimeAction[] rev = new CCFiniteTimeAction[m_pActions.Length];
            for (int i = 0; i < m_pActions.Length; i++)
            {
                rev[i] = m_pActions[i].Reverse();
            }

            return new CCParallel(rev);
        }
Beispiel #5
0
        public static CCSequence FromActions(params CCFiniteTimeAction[] actions)
        {
            CCFiniteTimeAction prev = actions[0];

            for (int i = 1; i < actions.Length; i++)
            {
                prev = new CCSequence(prev, actions[i]);
            }

            return((CCSequence)prev);
        }
Beispiel #6
0
        protected bool InitOneTwo(CCFiniteTimeAction actionOne, CCFiniteTimeAction aciontTwo)
        {
            Debug.Assert(actionOne != null);
            Debug.Assert(aciontTwo != null);

            float d = actionOne.Duration + aciontTwo.Duration;
            base.InitWithDuration(d);

            m_pActions[0] = actionOne;
            m_pActions[1] = aciontTwo;

            return true;
        }
        protected bool InitOneTwo(CCFiniteTimeAction actionOne, CCFiniteTimeAction aciontTwo)
        {
            Debug.Assert(actionOne != null);
            Debug.Assert(aciontTwo != null);

            float d = actionOne.Duration + aciontTwo.Duration;

            base.InitWithDuration(d);

            m_pActions[0] = actionOne;
            m_pActions[1] = aciontTwo;

            return(true);
        }
Beispiel #8
0
 public override object Copy(ICCCopyable zone)
 {
     if (zone != null)
     {
         var ret = zone as CCReverseTime;
         base.Copy(zone);
         m_pOther = (CCFiniteTimeAction) ret.m_pOther; // .Copy() was in here before
         return ret;
     }
     else
     {
         return new CCReverseTime(this);
     }
 }
Beispiel #9
0
 public override object Copy(ICopyable zone)
 {
     if (zone != null)
     {
         var ret = zone as CCReverseTime;
         base.Copy(zone);
         m_pOther = (CCFiniteTimeAction)ret.m_pOther;                 // .Copy() was in here before
         return(ret);
     }
     else
     {
         return(new CCReverseTime(this));
     }
 }
Beispiel #10
0
        protected bool InitOneTwo(CCFiniteTimeAction actionOne, CCFiniteTimeAction actionTwo)
        {
            Debug.Assert(actionOne != null);
            Debug.Assert(actionTwo != null);

            float d = actionOne.Duration + actionTwo.Duration;
            base.InitWithDuration(d);

            m_pActions[0] = actionOne;
            m_pActions[1] = actionTwo;

            _HasInfiniteAction = (actionOne is CCRepeatForever) || (actionTwo is CCRepeatForever);

            return true;
        }
Beispiel #11
0
        protected bool InitOneTwo(CCFiniteTimeAction actionOne, CCFiniteTimeAction actionTwo)
        {
            Debug.Assert(actionOne != null);
            Debug.Assert(actionTwo != null);

            float d = actionOne.Duration + actionTwo.Duration;

            base.InitWithDuration(d);

            m_pActions[0] = actionOne;
            m_pActions[1] = actionTwo;

            _HasInfiniteAction = (actionOne is CCRepeatForever) || (actionTwo is CCRepeatForever);

            return(true);
        }
Beispiel #12
0
        public CCSpawn(params CCFiniteTimeAction[] actions)
        {
            CCFiniteTimeAction prev = actions[0];

            if (actions.Length == 1)
            {
                InitOneTwo(prev, new CCExtraAction());
            }
            else
            {
                for (int i = 1; i < actions.Length - 1; i++)
                {
                    prev = new CCSpawn(prev, actions[i]);
                }

                InitOneTwo(prev, actions[actions.Length - 1]);
            }
        }
Beispiel #13
0
        private void RunAction(CCNode node, CCBSequenceProperty pSeqProp, float fTweenDuration)
        {
            List <CCBKeyframe> keyframes = pSeqProp.Keyframes;
            int numKeyframes             = keyframes.Count;

            if (numKeyframes > 1)
            {
                // Make an animation!
                var actions = new List <CCFiniteTimeAction>();

                CCBKeyframe keyframeFirst = keyframes[0];
                float       timeFirst     = keyframeFirst.Time + fTweenDuration;

                if (timeFirst > 0)
                {
                    actions.Add(new CCDelayTime(timeFirst));
                }

                for (int i = 0; i < numKeyframes - 1; ++i)
                {
                    CCBKeyframe kf0 = keyframes[i];
                    CCBKeyframe kf1 = keyframes[i + 1];

                    CCActionInterval action = GetAction(kf0, kf1, pSeqProp.Name, node);
                    if (action != null)
                    {
                        // Apply easing
                        action = GetEaseAction(action, kf0.EasingType, kf0.EasingOpt);

                        actions.Add(action);
                    }
                }

                if (actions.Count > 1)
                {
                    CCFiniteTimeAction seq = CCSequence.FromActions(actions.ToArray());
                    node.RunAction(seq);
                }
                else
                {
                    node.RunAction(actions[0]);
                }
            }
        }
Beispiel #14
0
        /// <summary>
        /// Makea full copy of this object and does not make any reference copies.
        /// </summary>
        /// <param name="zone"></param>
        /// <returns></returns>
        public override object Copy(ICopyable zone)
        {
            ICopyable  tmpZone = zone;
            CCParallel ret;

            if (tmpZone != null && tmpZone != null)
            {
                ret = tmpZone as CCParallel;
                base.Copy(tmpZone);

                CCFiniteTimeAction[] cp = new CCFiniteTimeAction[m_pActions.Length];
                for (int i = 0; i < m_pActions.Length; i++)
                {
                    cp[i] = m_pActions[i].Copy() as CCFiniteTimeAction;
                }
                ret.m_pActions = cp;
                return(ret);
            }
            else
            {
                return(new CCParallel(this));
            }
        }
Beispiel #15
0
        /// <summary>
        /// Makea full copy of this object and does not make any reference copies.
        /// </summary>
        /// <param name="zone"></param>
        /// <returns></returns>
        public override object Copy(ICopyable zone)
        {
            ICopyable tmpZone = zone;
            CCParallel ret;

            if (tmpZone != null && tmpZone != null)
            {
                ret = tmpZone as CCParallel;
                base.Copy(tmpZone);

                CCFiniteTimeAction[] cp = new CCFiniteTimeAction[m_pActions.Length];
                for (int i = 0; i < m_pActions.Length; i++)
                {
                    cp[i] = m_pActions[i].Copy() as CCFiniteTimeAction;
                }
                ret.m_pActions = cp;
                return ret;
            }
            else
            {
                return new CCParallel(this);
            }
        }
Beispiel #16
0
 /// <summary>
 /// Reverses the current parallel sequence.
 /// </summary>
 /// <returns></returns>
 public override CCFiniteTimeAction Reverse()
 {
     CCFiniteTimeAction[] rev = new CCFiniteTimeAction[m_pActions.Length];
     m_pActions.CopyTo(rev, 0);
     return(new CCParallel(rev));
 }
Beispiel #17
0
 public CCReverseTime(CCFiniteTimeAction action) : base(action.Duration)
 {
     m_pOther = action;
 }
Beispiel #18
0
 protected CCSpawn(CCFiniteTimeAction action1, CCFiniteTimeAction action2)
 {
     InitOneTwo(action1, action2);
 }
Beispiel #19
0
 protected CCReverseTime(CCReverseTime copy)
     : base(copy)
 {
     m_pOther = copy.m_pOther;
 }
Beispiel #20
0
 protected CCSpawn (CCFiniteTimeAction action1, CCFiniteTimeAction action2)
 {
     InitOneTwo(action1, action2);
 }
Beispiel #21
0
 public CCSequence(CCFiniteTimeAction action1, CCFiniteTimeAction action2)
 {
     InitOneTwo(action1, action2);
 }
Beispiel #22
0
 protected CCReverseTime(CCReverseTime copy)
     : base(copy)
 {
     m_pOther = copy.m_pOther;
 }
Beispiel #23
0
 public CCReverseTime(CCFiniteTimeAction action) : base(action.Duration)
 {
     m_pOther = action;
 }
Beispiel #24
0
 public CCSequence(CCFiniteTimeAction action1, CCFiniteTimeAction action2)
 {
     InitOneTwo(action1, action2);
 }
Beispiel #25
0
 /// <summary>
 /// Reverses the current parallel sequence.
 /// </summary>
 /// <returns></returns>
 public override CCFiniteTimeAction Reverse()
 {
     CCFiniteTimeAction[] rev = new CCFiniteTimeAction[m_pActions.Length];
     m_pActions.CopyTo(rev, 0);
     return (new CCParallel(rev));
 }