protected virtual void OnServerReturnObject(string name, CBaseController objectSync)
        {
            var id     = objectSync.GetID();
            var entity = m_NetworkManager.FindEntity(id);

            this.SetEntityObject(name, entity);
        }
        protected virtual void OnServerSyncObject(string name, CBaseController objectSync)
        {
            var objectSyncController = objectSync as CObjectController;
            var entityNonPlayable    = this.GetEntityObject(name, objectSyncController);

            this.m_NetworkManager.OnServerRegisterEntity(entityNonPlayable, entityNonPlayable.GetComponent <NetworkIdentity>().connectionToClient);
            NetworkServer.Spawn(entityNonPlayable.gameObject);
        }
示例#3
0
 public void SetObject(string name, CBaseController obj)
 {
     if (obj == null)
     {
         return;
     }
     if (m_ObjectPools.ContainsKey(name))
     {
         // TODO
     }
     else
     {
         m_ObjectPools [name] = new ObjectPool <CBaseController> ();
     }
     m_ObjectPools [name].Set(obj);
     if (this.OnSetObject != null)
     {
         this.OnSetObject(name, obj);
     }
     obj.transform.SetParent(this.transform);
 }