Ejemplo n.º 1
0
        void OnEndMove(object sender, EventArgs arg)
        {
            UnitMoveEndEvtArg e = arg as UnitMoveEndEvtArg;

            if (e.actor == this)
            {
                Debug.Log(e.actor.viewObj.gameGo.name + "end move");
                SetAnimationStateInteger("speed", 0);
            }
        }
Ejemplo n.º 2
0
        private void OnMoveEnd()
        {
            bMoved = false;

            if (target != null)
            {
                Actor actor = target.gameObject.GetComponent <Actor>();
                //actor.SetAnimationStateInteger("speed", 0);
                UnitMoveEndEvtArg arg = new UnitMoveEndEvtArg();
                arg.actor = actor;
                context.FireEvent(this, EventType.EVT_UNIT_MOVE_END, arg);
                GlobalClient.GameManager.LogicManager.InputCmd(Cmd.UnitMoveEnd, actor.viewObj.gameObj.mCharData.entityName);
            }
        }
Ejemplo n.º 3
0
        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;
            }
        }