public JSpawn(params JFiniteTimeAction[] actions) { JFiniteTimeAction prev = actions [0]; JFiniteTimeAction next = null; if (actions.Length == 1) { next = new JExtraAction(); } else { // We create a nested set of JSpawnActions out of all of the actions for (int i = 1; i < actions.Length - 1; i++) { prev = new JSpawn(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); InitJSpawn(prev, next); } }
public JSpawnState(JSpawn action, GameObject target) : base(action, target) { ActionOne = action.ActionOne; ActionTwo = action.ActionTwo; ActionStateOne = (JFiniteTimeActionState)ActionOne.StartAction(target); ActionStateTwo = (JFiniteTimeActionState)ActionTwo.StartAction(target); }