Exemple #1
0
        public void HideEntity(UInt64 sGUID)
        {
            if (!AllEntitys.ContainsKey(sGUID))
            {
                return;
            }

            Ientity entity = null;

            if (EntityManager.AllEntitys.TryGetValue(sGUID, out entity) && entity.entityType == EntityType.Player)
            {
                if (PlayerManager.Instance.LocalAccount.ObType == ObPlayerOrPlayer.PlayerType)
                {
                    Iplayer.AddOrDelEnemy((Iplayer)entity, false);
                    //  UIEnemyTeamMateInfo.Instance.RemovePlayerEnemy((Iplayer)entity);
                }
            }

            //if (UIMiniMap.Instance != null)
            //{
            //    UIMiniMap.Instance.DestroyMapElement(sGUID);
            //}

            Iselfplayer player = PlayerManager.Instance.LocalPlayer;

            if (player != null && player.SyncLockTarget == AllEntitys[sGUID])
            {
                player.SetSyncLockTarget(null);
            }

            AllEntitys[sGUID].HideXueTiao();

            AllEntitys[sGUID].realObject.active = false;
        }
Exemple #2
0
        public override void OnUpdate()
        {
            base.OnUpdate();
            Iselfplayer playerSelf = PlayerManager.Instance.LocalPlayer;

            if (playerSelf != null && playerSelf.realObject != null && !this.IsSameCamp(playerSelf.EntityCamp))
            {                                                                                          //enemy player
                float dis = Vector3.Distance(playerSelf.objTransform.position, objTransform.position); //self player distance with enemy player
                if (dis > GameConstDefine.PlayerLockTargetDis)
                {
                    return;
                }
                if ((this.FSM != null && this.FSM.State == BlGame.FSM.FsmState.FSM_STATE_DEAD) || (this.realObject.activeSelf == false))
                {
                    AddOrDelEnemy(this, false);// UIEnemyTeamMateInfo.Instance.RemovePlayerEnemy(this);
                }
                else  // if(UIEnemyTeamMateInfo.Instance != null){
                      // UIEnemyTeamMateInfo.Instance.SetPlayerEnemy(this);
                {
                    if (this.realObject.active == true)
                    {
                        AddOrDelEnemy(this, true);
                    }
                }
            }
        }
Exemple #3
0
        public override Ientity HandleCreateEntity(UInt64 sGUID, EntityCampType campType)           //entity id
        {
            Iplayer player;

            if (GameUserModel.Instance.IsLocalPlayer(sGUID))
            {
                player = new Iselfplayer(sGUID, campType);
            }
            else
            {
                player = new Iplayer(sGUID, campType);
            }

            player.GameUserId = sGUID;
            return(player);
        }
Exemple #4
0
        /// <summary>
        /// Entity死亡
        /// </summary>
        public virtual void OnEnterDead()
        {
            //目标死亡主角相关处理
            Iselfplayer player = PlayerManager.Instance.LocalPlayer;

            if (player != null && player.SyncLockTarget != null && GameObjGUID == player.SyncLockTarget.GameObjGUID)
            {
                player.SetSyncLockTarget(null);
            }

            //播放死亡声音
            Vector3 pos = PlayerManager.Instance.LocalPlayer.RealEntity.transform.position;

            if (GetDistanceToPos(pos) <= 30)
            {
                this.PlayDeadSound();
            }

            //建筑物更换模型和播表现特效
            if (this.entityType == EntityType.Building && this.NPCCateChild != ENPCCateChild.eNPCChild_BUILD_Base)
            {
                if (!EntityManager.GetHomeBaseList().Contains(this))
                {
                    GameMethod.SetLoadJianTaBaoZha(this);

                    int ret = EntityManager.HandleDelectEntity(this.GameObjGUID);
                    if (ret != 0)
                    {
                        Debug.LogError("OnEnterDead HandleDelectEntity:" + GameObjGUID + "failed");
                    }
                }
                EventCenter.Broadcast <Ientity>(EGameEvent.eGameEvent_NotifyBuildingDes, this);
                return;
            }

            //非建筑物播死亡动画和清理血条等状态
            this.DoEntityDead();
            RealEntity.PlayerDeadAnimation();
        }
Exemple #5
0
        public static int HandleDelectEntity(UInt64 sGUID)
        {
            if (!AllEntitys.ContainsKey(sGUID))
            {
                return((int)ReturnRet.eT_DelEntityFailed);
            }
            Ientity entity = null;

            if (EntityManager.AllEntitys.TryGetValue(sGUID, out entity) && entity.entityType == EntityType.Player)
            {
                if (PlayerManager.Instance.LocalAccount.ObType == ObPlayerOrPlayer.PlayerType)
                {
                    Iplayer.AddOrDelEnemy((Iplayer)entity, false);
                }
            }
            Iselfplayer player = PlayerManager.Instance.LocalPlayer;

            if (player != null && player.SyncLockTarget == AllEntitys[sGUID])
            {
                player.SetSyncLockTarget(null);
            }
            if (entity.entityType == EntityType.Building)
            {
                MonoBehaviour.DestroyImmediate(AllEntitys[sGUID].realObject);
            }
            else
            {
                //删除GameObject
                GameObjectPool.Instance.ReleaseGO(AllEntitys[sGUID].resPath, AllEntitys[sGUID].realObject, PoolObjectType.POT_Entity);
            }
            AllEntitys[sGUID].DestroyXueTiao();
            AllEntitys[sGUID] = null;
            AllEntitys.Remove(sGUID);

            return((int)ReturnRet.eT_Normal);
        }