Ejemplo n.º 1
0
        protected override void Run(Unit entity, Death_Map message)
        {           
            ///删除 客户端 死亡的单元实例或更新玩家位置
            entity.GetComponent<AoiUnitComponent>().DeathRemove();

            ///删除 死亡的 Unit
            switch (entity.UnitType)
            {
                case UnitType.Monster:
                    Game.Scene.GetComponent<MonsterUnitComponent>().Remove(entity.Id);
                    ///CD刷新时间到后,重新生成
                    
                    //Console.WriteLine(" Death_MapHandler-33-unittype/unitid: " + entity.UnitType + " / " + entity.Id);                    
                    break;
                case UnitType.Player:
                    ///重新生产Unit,先取得参数,后删除,再发送生产指令
                    T2M_CreateUnit t2M_Create = entity.T2M_CreateUnit();

                    Console.WriteLine(" Death_MapHandler-31-playerid: " + t2M_Create.RolerId + " /unitid: " + t2M_Create.UnitId + " /GateSessionId: " + t2M_Create.GateSessionId+" /Count:" + Game.Scene.GetComponent<UnitComponent>().Count);

                    //后删除
                    Game.Scene.GetComponent<UnitComponent>().Remove(entity.Id);

                    //再发送生产指令
                    CreatePlayerAsync(t2M_Create).Coroutine();

                    Console.WriteLine(" Death_MapHandler-39-players: " + Game.Scene.GetComponent<UnitComponent>().Count);
                    break;
            }
            ///通知 播放 死亡录像
            ///TOTO
        }
Ejemplo n.º 2
0
        public static T2M_CreateUnit T2M_CreateUnit(this Unit unit)
        {
            //重置生产Player单元Unit
            Player         player         = Game.Scene.GetComponent <PlayerComponent>().GetByUnitId(unit.Id);
            T2M_CreateUnit t2M_CreateUnit = new T2M_CreateUnit()
            {
                UnitType = (int)UnitType.Player, RolerId = player.Id, GateSessionId = unit.GetComponent <UnitGateComponent>().GateSessionActorId, UnitId = unit.Id
            };

            return(t2M_CreateUnit);
        }
Ejemplo n.º 3
0
 // 创建 新的 Unit
 protected async ETVoid CreatePlayerAsync(T2M_CreateUnit message)
 {
     // 在map服务器上创建战斗Unit
     M2T_CreateUnit m2T_Response = (M2T_CreateUnit)await SessionHelper.MapSession().Call(message);
 }