void OnBeginMove(object sender, EventArgs arg) { UnitMoveBeginEvtArg e = arg as UnitMoveBeginEvtArg; if (e.actor == this) { Debug.Log(e.actor.viewObj.gameGo.name + "begin move"); SetAnimationStateInteger("speed", (int)(speed)); } }
private void OnMoveStart() { bMoved = true; if (target != null) { Actor actor = target.gameObject.GetComponent <Actor>(); //actor.SetAnimationStateInteger("speed", ((int)moveSpeed)); UnitMoveBeginEvtArg arg = new UnitMoveBeginEvtArg(); arg.actor = actor; context.FireEvent(this, EventType.EVT_UNIT_MOVE_BEGIN, arg); GlobalClient.GameManager.LogicManager.InputCmd(Cmd.UnitMoveBegin, actor.viewObj.gameObj.mCharData.entityName); } }
public void DoCmd(Cmd cmd, string param, int roleId) { switch (cmd) { case Cmd.UseSkill: for (int i = 0; i < entities.Count; ++i) { if (entities[i].mCharData.clientID == roleId) { (entities[i] as CreatureEntity).DoSkill(int.Parse(param)); } } break; case Cmd.Move: break; case Cmd.Turn: break; case Cmd.UnitMoveBegin: { for (int i = 0; i < entities.Count; i++) { //单位名字和玩家ID要对应上 if (entities[i].mCharData.clientID == roleId && entities[i].mCharData.entityName == param) { if (GlobalClient.GameManager.ViewManager.ViewObjMap.ContainsKey(entities[i].ID)) { Actor ac = GlobalClient.GameManager.ViewManager.ViewObjMap[entities[i].ID].actor; UnitMoveBeginEvtArg arg = new UnitMoveBeginEvtArg(); arg.actor = ac; context.FireEvent(this, EventType.EVT_UNIT_MOVE_BEGIN, arg); } } } } break; case Cmd.UnitMoveEnd: { for (int i = 0; i < entities.Count; i++) { //单位名字和玩家ID要对应上 if (entities[i].mCharData.clientID == roleId && entities[i].mCharData.entityName == param) { if (GlobalClient.GameManager.ViewManager.ViewObjMap.ContainsKey(entities[i].ID)) { Actor ac = GlobalClient.GameManager.ViewManager.ViewObjMap[entities[i].ID].actor; UnitMoveEndEvtArg arg = new UnitMoveEndEvtArg(); arg.actor = ac; context.FireEvent(this, EventType.EVT_UNIT_MOVE_END, arg); } } } } break; default: Debug.LogError("无效命令"); break; } }