Esempio n. 1
0
    void CreateModel(int id, int model, int mapx, int mapy, Vector3 vec, bool playBornFX = true)
    {

        EntityMonster entity = new EntityMonster();
        entity.ID = (uint)id;
        entity.model = model;
        Vector3 Point = new Vector3();
        MogoUtils.GetPointInTerrain((float)mapx / 100, (float)mapy / 100, out Point);
        entity.PlayBornFX = playBornFX;
        entity.BillBoard = false;
        entity.position = Point;
        entity.rotation = vec;
        entity.CreateModel();
        EventDispatcher.AddEventListener<GameObject, Vector3>(MogoMotor.ON_MOVE_TO, entity.OnMoveTo);
        m_entityList[id] = entity;
    }
Esempio n. 2
0
 public void InitTDBlood(EntityMonster tower)
 {
     MainUIViewManager.Instance.ShowTDBlood(true);
 }
Esempio n. 3
0
    // 协议处理函数, 新的 entity 进入视野
    static private void AOINewEntity(CellAttachedInfo info)
    {
        // todo:  先硬编码, 以后改成 从 def 中 自动化
        EntityParent entity;
        LoggerHelper.Debug(info.entity.Name);
        if (isReConnect && !mainCameraCompleted)
        {//断线重连场景没加载完,缓存起来
            others.Add(info);
            return;
        }
        if (Entities.ContainsKey(info.id) || (thePlayer != null && thePlayer.ID == info.id))
        {
            LoggerHelper.Debug("has same id entity in world");
            return;
        }
        if ((info.entity.Name == "Monster" ||
            info.entity.Name == "Mercenary" ||
            info.entity.Name == "Drop") && inCity)
        {
            //主城不出现Monster Mercenary,用于切场景的瞬间收到创建协议
            return;
        }
        switch (info.entity.Name)
        {
            case "Avatar"://对应Avatar.def
                if (SystemConfig.Instance.PlayerCountInScreen <= playerCount
                    || (MogoWorld.thePlayer != null && MogoWorld.thePlayer.IsNewPlayer))
                {
                    LoggerHelper.Debug("EntityPlayer over count: " + playerCount);
                    return;
                }
                if (MogoWorld.IsClientMission)
                {
                    return;
                }
                entity = new EntityPlayer();
                entity.vocation = Vocation.Warrior;
                break;
            case "NPC"://对应NPC.def
                // entity = new EntityNPC();
                entity = new EntityParent();
                break;
            case "Monster": //对应Monster.def
                entity = new EntityMonster();
                break;
            case "Mercenary": //对应Monster.def
                entity = new EntityMercenary();
                break;
            case "Drop": //对应Drop.def
                entity = new EntityDrop();
                Vector3 newPosi = MogoWorld.FindEmptyDropPoint(info.position);
                (entity as EntityDrop).SetTweenTarget(newPosi);
                //LoggerHelper.Error("f**k end " + info.id + " n " + newPosi.x + " " + newPosi.y + " " + newPosi.z);
                break;
            case "TeleportPointSrc": //对应TeleportPointSrc.def
                entity = new EntityTeleportSrc();
                break;
            case "Dummy": //CMonster.def
                entity = new EntityDummy();
                break;
            default:
                entity = new EntityParent();
                break;
        }
        entity.ID = info.id;
        entity.entity = info.entity;
        entity.SetEntityCellInfo(info);
        entity.OnEnterWorld();
        if (!isLoadingScene)
            entity.CreateModel();
        //LoggerHelper.Error("AOINewEntity: etype: " + info.entity.Name + " eid: " + entity.ID + " pos: " + entity.position);
        OnEnterWorld(entity);

        EventDispatcher.TriggerEvent(Events.CampaignEvent.SetPlayerMessage, entity);
    }