private void OnUnitMove(Hashtable obj) { string guid = (string)obj["guid"]; if (guid != _guid) { return; } string actionInfo = (string)obj["action"]; EMoveActionType actionType = (EMoveActionType)int.Parse(actionInfo); //Debug.LogFormat("actionInfo, {0}", actionType); DoNewAction(actionType); }
private void DoNewAction(EMoveActionType actionType) { switch (actionType) { case EMoveActionType.Forward: DoMove(1); break; case EMoveActionType.Back: DoMove(-1); break; case EMoveActionType.Left: DoRotate(-1); break; case EMoveActionType.Right: DoRotate(1); break; default: throw new ArgumentOutOfRangeException("actionType", actionType, null); } }