private void RepairObject(CEntity entity, CObjectController controller) { entity.SetObjectSync(controller); entity.controlData = controller.GetData(); entity.SetPosition(controller.GetPosition()); entity.SetStartPosition(controller.GetPosition()); entity.name = "Network-" + entity.controlData.name; entity.transform.SetParent(this.transform); }
public virtual bool OnClientRegisterEntity(CEntity entity) { if (m_RegisterEntities.ContainsKey(entity.GetID()) == true) { return(false); } m_RegisterEntities.Add(entity.GetID(), entity); return(true); }
public void SetEntityObject(string name, CEntity entity) { if (entity == null) { return; } if (m_ObjectPools.ContainsKey(name)) { // TODO } else { m_ObjectPools [name] = new ObjectPool <CEntity> (); } m_ObjectPools [name].Set(entity); entity.transform.SetParent(this.transform); }
public virtual bool OnServerRegisterEntity(CEntity entity, NetworkConnection conn) { if (m_RegisterEntities.ContainsKey(entity.GetID()) == true) { return(false); } entity.SetID(Guid.NewGuid().ToString()); m_RegisterEntities.Add(entity.GetID(), entity); if (conn != null) { if (m_EntityConnecteds.ContainsKey(conn) == true) { return(false); } m_EntityConnecteds.Add(conn, entity); } return(true); }