public static void AddOrDelEnemy(Iplayer entity, bool add) { CEvent eve = new CEvent(EGameEvent.eGameEvent_AddOrDelEnemy); eve.AddParam("Add", add); eve.AddParam("Target", entity); EventCenter.SendEvent(eve); }
public void AddAccount(UInt64 sGUID, Iplayer entity) { if (AccountDic.ContainsKey(sGUID)) { Debug.LogError("Has the same Guid: " + sGUID); return; } AccountDic.Add(sGUID, entity); }
public bool IsSameCamp(Iplayer player) { if ((player.GameUserSeat % 2) == (GameUserSeat % 2)) { return(true); } else { return(false); } }
public override void SetCommonProperty(Ientity entity, int id) { base.SetCommonProperty(entity, id); HeroConfigInfo info = ConfigReader.GetHeroInfo(id); entity.ColliderRadius = info.HeroCollideRadious / 100; Iplayer mpl = (Iplayer)entity; if (mpl.GameUserNick == "" || mpl.GameUserNick == null) { mpl.GameUserNick = RandomNameData.Instance.GetRandName(); } }
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); }
/// <summary> /// 从Entity回调过来 /// 点击中Entity的事件 /// </summary> public void OnEntityFingerClick() { Iplayer pl = PlayerManager.Instance.LocalPlayer; if (pl != null) { if (pl.FSM != null && pl.FSM.State == FsmState.FSM_STATE_DEAD) { return; } if (this.FSM != null && this.FSM.State == FsmState.FSM_STATE_DEAD) { return; } float dis = Vector3.Distance(pl.objTransform.position, this.objTransform.position); if (dis > GameDefine.GameConstDefine.PlayerLockTargetDis) { return; } if (this.GameObjGUID == pl.GameObjGUID) { return; } if (ConfigReader.NpcXmlInfoDict.ContainsKey(NpcGUIDType) && ConfigReader.NpcXmlInfoDict[NpcGUIDType].un32ShopID != 0) { Debug.LogError(NpcGUIDType); OpenShop(); return; } //pl.SetSyncLockTarget(this); } else { pl = PlayerManager.Instance.LocalAccount; } //if (Vector3.Distance(pl.realObject.transform.position, this.realObject.transform.position) > GameConstDefine.PlayerLockTargetDis) //{ // return; //} if (ConfigReader.NpcXmlInfoDict.ContainsKey(NpcGUIDType) && ConfigReader.NpcXmlInfoDict[NpcGUIDType].un32ShopID != 0) { return; } pl.SetSyncLockTarget(this); }
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); }