public ActionSteps GetActionStep(ref int index) { if (steps == null || steps.Count == 0) { if (defaultStep == null) { defaultStep = new ActionSteps(); defaultStep.branches = new List <ActionAnim>(); ActionAnim aa = new ActionAnim(); aa.input = input; aa.targetAnim = targetAnimation; defaultStep.branches.Add(aa); } return(defaultStep); } if (index > steps.Count - 1) { index = 0; } ActionSteps retVal = steps[index]; if (index > steps.Count - 1) { index = 0; } else { index++; } return(retVal); }
public static void DeepCopyStepsList(Action from, Action to) { to.steps = new List <ActionSteps>(); for (int i = 0; i < from.steps.Count; i++) { ActionSteps step = new ActionSteps(); DeepCopyStep(from.steps[i], step); to.steps.Add(step); } }
public static void DeepCopyStep(ActionSteps from, ActionSteps to) { to.branches = new List <ActionAnim>(); for (int i = 0; i < from.branches.Count; i++) { ActionAnim a = new ActionAnim(); a.input = from.branches[i].input; a.targetAnim = from.branches[i].targetAnim; to.branches.Add(a); } }