//根据传入的参数决定要执行的动作 public void SSEventAction(SSAction source, SSActionState events = SSActionState.COMPLETED, int intParam = 0, string strParam = null, Object objParam = null) { currentState = currentState > ActionState.WALKBACK ? ActionState.IDLE : (ActionState)((int)currentState + 1); // 改变当前状态 switch (currentState) { case ActionState.WALKLEFT: walkLeft(); break; case ActionState.WALKRIGHT: walkRight(); break; case ActionState.WALKFORWARD: walkForward(); break; case ActionState.WALKBACK: walkBack(); break; default: idle(); break; } // 执行下个动作 }
public void SSEventAction(SSAction source, SSActionState events = SSActionState.COMPLETED, int intParam = 0, string strParam = null, Object objParam = null) //通过对callback函数的调用执行下个动作 { source.destory = false; // 当前动作不能销毁(有可能执行下一次) this.start++; if (this.start >= this.sequence.Count) { this.start = 0; if (this.repeat > 0) { repeat--; } if (this.repeat == 0) { this.destory = true; this.callback.SSEventAction(this); } } }