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; }
/// <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(); }
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); }