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; }
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; }
/// <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)); }
/// <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); }
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); }
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); }
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); } }
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)); } }
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; }
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); }
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]); } }
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]); } } }
/// <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)); } }
/// <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); } }
/// <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)); }
public CCReverseTime(CCFiniteTimeAction action) : base(action.Duration) { m_pOther = action; }
protected CCSpawn(CCFiniteTimeAction action1, CCFiniteTimeAction action2) { InitOneTwo(action1, action2); }
protected CCReverseTime(CCReverseTime copy) : base(copy) { m_pOther = copy.m_pOther; }
protected CCSpawn (CCFiniteTimeAction action1, CCFiniteTimeAction action2) { InitOneTwo(action1, action2); }
public CCSequence(CCFiniteTimeAction action1, CCFiniteTimeAction action2) { InitOneTwo(action1, action2); }
/// <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)); }