public override void OnEnter() { base.OnEnter(); SizeF s = Director.Instance.WinSize; // // startPosition can be any coordinate, but since the movement // is relative to the Bezier curve, make it (0,0) // // sprite 1 BezierConfig bezier = new BezierConfig(); bezier.StartPosition = PointF.Empty; bezier.ControlPoint1 = new PointF(0, s.Height / 2); bezier.ControlPoint2 = new PointF(300, -s.Height / 2); bezier.EndPosition = new PointF(300, 100); BezierBy bezierForward = new BezierBy(3, bezier); BezierBy bezierBack = bezierForward.Reverse() as BezierBy; Sequence seq = new Sequence(bezierForward, bezierBack); RepeatForever rep = new RepeatForever(seq); // sprite 2 BezierConfig bezier2 = new BezierConfig(); bezier2.StartPosition = PointF.Empty; bezier2.ControlPoint1 = new PointF(100, s.Height / 2); bezier2.ControlPoint2 = new PointF(200, -s.Height / 2); bezier2.EndPosition = new PointF(300, 0); BezierBy bezierForward2 = new BezierBy(3, bezier2); BezierBy bezierBack2 = bezierForward2.Reverse() as BezierBy; Sequence seq2 = new Sequence(bezierForward2, bezierBack2); RepeatForever rep2 = new RepeatForever(seq2); _grossini.RunAction(rep); _tamara.RunAction(rep2); }
public override Action Clone() { Sequence newSequence = new Sequence(_actions[0], _actions[1]); newSequence._split = _split; newSequence._last = _last; return newSequence; }
public static Sequence Construct(params FiniteTimeAction[] actions) { if (actions == null) { throw new ArgumentNullException("actions"); } if (actions.Length < 2) { throw new ArgumentException("Must construct sequence with at least 2 actions", "actions"); } FiniteTimeAction prev = actions[0]; for (int i = 1; i < actions.Length; ++i) { FiniteTimeAction now = actions[i]; prev = new Sequence(prev, now); } return prev as Sequence; }