private void OnRotate(SnakeCmd cmd) { float rotSpeed = ((RotateCmd)cmd).rotParam.rotSpeed; Vector3 rot = Vector3.up; transform.Rotate(rot * rotSpeed); }
private void OnMove(SnakeCmd cmd) { float moveSpeed = ((MoveCmd)cmd).moveParam.moveSpeed; Vector3 pos = transform.position; pos += transform.forward * moveSpeed; transform.position = pos; }
public void ExcAction(SnakeCmd cmd) { Action <SnakeCmd> func; if (_actions.TryGetValue(cmd.type, out func)) { func?.Invoke(cmd); } }