public HandleReplicatedEntityDataSpawn(GameWorld world, NetworkServer network, ReplicatedEntityRegistry assetRegistry, ReplicatedEntityCollection entityCollection) : base(world) { m_assetRegistry = assetRegistry; m_entityCollection = entityCollection; m_network = network; }
public ReplicatedEntityModuleClient(GameWorld world, BundledResourceManager resourceSystem) { m_world = world; m_resourceSystem = resourceSystem; m_assetRegistry = resourceSystem.GetResourceRegistry <ReplicatedEntityRegistry>(); m_entityCollection = new ReplicatedEntityCollection(m_world); // Load all replicated entity resources for (var i = 0; i < m_assetRegistry.entries.Length; i++) { if (m_assetRegistry.entries[i].factory != null) { continue; } var prefabGuid = m_assetRegistry.entries[i].prefab.guid; m_resourceSystem.LoadSingleAssetResource(prefabGuid); } if (world.SceneRoot != null) { m_SystemRoot = new GameObject("ReplicatedEntitySystem"); m_SystemRoot.transform.SetParent(world.SceneRoot.transform); } }
public ReplicatedEntityModuleServer(GameWorld world, BundledResourceManager resourceSystem, NetworkServer network) { m_world = world; m_assetRegistry = resourceSystem.GetResourceRegistry <ReplicatedEntityRegistry>(); m_entityCollection = new ReplicatedEntityCollection(m_world); if (world.SceneRoot != null) { m_SystemRoot = new GameObject("ReplicatedEntitySystem"); m_SystemRoot.transform.SetParent(world.SceneRoot.transform); } m_handleSpawn = m_world.GetECSWorld().CreateManager <HandleReplicatedEntitySpawn>(m_world, m_SystemRoot, network, m_assetRegistry, m_entityCollection); m_handleDataSpawn = m_world.GetECSWorld().CreateManager <HandleReplicatedEntityDataSpawn>(m_world, network, m_assetRegistry, m_entityCollection); m_handleDespawn = m_world.GetECSWorld().CreateManager <HandleReplicatedEntityDespawn>(m_world, network, m_entityCollection); m_handleDataDespawn = m_world.GetECSWorld().CreateManager <HandleReplicatedEntityDataDespawn>(m_world, network, m_entityCollection); // Make sure all replicated entities are streamed in for (var i = 0; i < m_assetRegistry.entries.Length; i++) { if (m_assetRegistry.entries[i].factory != null) { continue; } resourceSystem.LoadSingleAssetResource(m_assetRegistry.entries[i].prefab.guid); } }
public ReplicatedEntityModuleServer(GameWorld world, BundledResourceManager resourceSystem, NetworkServer network) { m_world = world; m_assetRegistry = resourceSystem.GetResourceRegistry <ReplicatedEntityRegistry>(); m_entityCollection = new ReplicatedEntityCollection(m_world); if (world.SceneRoot != null) { m_SystemRoot = new GameObject("ReplicatedEntitySystem"); m_SystemRoot.transform.SetParent(world.SceneRoot.transform); } m_handleDataSpawn = m_world.GetECSWorld().CreateManager <HandleReplicatedEntityDataSpawn>(m_world, network, m_assetRegistry, m_entityCollection); m_handleDataDespawn = m_world.GetECSWorld().CreateManager <HandleReplicatedEntityDataDespawn>(m_world, network, m_entityCollection); m_UpdateReplicatedOwnerFlag = m_world.GetECSWorld().CreateManager <UpdateReplicatedOwnerFlag>(m_world); m_UpdateReplicatedOwnerFlag.SetLocalPlayerId(-1); // Load all replicated entity resources m_assetRegistry.LoadAllResources(resourceSystem); }
protected override void OnCreate() { EntityManager.CreateEntity(typeof(LocalPlayer)); SetSingleton(new LocalPlayer { PlayerId = -1, CharacterEntity = Entity.Null }); replicatedEntities = new ReplicatedEntityCollection(EntityManager); factoryManager = new ReplicatedEntityFactoryManager(); var itemFactory = new ItemFactory(); factoryManager.RegisterFactory((ushort)EntityType.Character, new CharacterFactory()); factoryManager.RegisterFactory((ushort)EntityType.Plate, itemFactory); factoryManager.RegisterFactory((ushort)EntityType.PlateDirty, itemFactory); factoryManager.RegisterFactory((ushort)EntityType.Shrimp, itemFactory); factoryManager.RegisterFactory((ushort)EntityType.ShrimpSlice, itemFactory); // factoryManager.RegisterFactory((ushort) EntityType.ShrimpProduct, itemFactory); factoryManager.RegisterFactory((ushort)EntityType.Cucumber, itemFactory); factoryManager.RegisterFactory((ushort)EntityType.CucumberSlice, itemFactory); factoryManager.RegisterFactory((ushort)EntityType.Rice, itemFactory); factoryManager.RegisterFactory((ushort)EntityType.RiceCooked, itemFactory); factoryManager.RegisterFactory((ushort)EntityType.KelpSlice, itemFactory); factoryManager.RegisterFactory((ushort)EntityType.Sushi, itemFactory); factoryManager.RegisterFactory((ushort)EntityType.Pot, itemFactory); // factoryManager.RegisterFactory((ushort) EntityType.PotFull, itemFactory); factoryManager.RegisterFactory((ushort)EntityType.Extinguisher, itemFactory); factoryManager.RegisterFactory((ushort)EntityType.Game, new GameFactory()); factoryManager.RegisterFactory((ushort)EntityType.Menu, new MenuFactory()); // m_systemsToUpdate.Add(World.GetOrCreateSystem<UpdateReplicatedOwnerFlag>()); worldSceneEntitiesSystem = World.GetOrCreateSystem <WorldSceneEntitiesSystem>(); }
public HandleReplicatedEntitySpawn(GameWorld world, GameObject systemRoot, NetworkServer network, ReplicatedEntityRegistry assetRegistry, ReplicatedEntityCollection entityCollection) : base(world) { m_systemRoot = systemRoot; m_assetRegistry = assetRegistry; m_entityCollection = entityCollection; m_network = network; }
public ReplicatedEntityModuleClient(GameWorld world, BundledResourceManager resourceSystem) { m_world = world; m_resourceSystem = resourceSystem; m_assetRegistry = resourceSystem.GetResourceRegistry <ReplicatedEntityRegistry>(); m_entityCollection = new ReplicatedEntityCollection(m_world); m_UpdateReplicatedOwnerFlag = m_world.GetECSWorld().CreateSystem <UpdateReplicatedOwnerFlag>(m_world); // Load all replicated entity resources m_assetRegistry.LoadAllResources(resourceSystem); if (world.SceneRoot != null) { m_SystemRoot = new GameObject("ReplicatedEntitySystem"); m_SystemRoot.transform.SetParent(world.SceneRoot.transform); } }
public ReplicatedEntityModuleServer(GameWorld world, BundledResourceManager resourceSystem, NetworkServer network) { m_world = world; m_assetRegistry = resourceSystem.GetResourceRegistry <ReplicatedEntityRegistry>(); m_entityCollection = new ReplicatedEntityCollection(m_world); m_handleDataSpawn = m_world.GetECSWorld().CreateSystem <HandleReplicatedEntityDataSpawn>(m_world, network, m_assetRegistry, m_entityCollection); m_handleDataDespawn = m_world.GetECSWorld().CreateSystem <HandleReplicatedEntityDataDespawn>(m_world, network, m_entityCollection); m_UpdateReplicatedOwnerFlag = m_world.GetECSWorld().CreateSystem <UpdateReplicatedOwnerFlag>(m_world); m_UpdateReplicatedOwnerFlag.SetLocalPlayerId(-1); // Load all replicated entity resources m_assetRegistry.LoadAllResources(resourceSystem); }
public HandleReplicatedEntityDespawn(GameWorld world, NetworkServer network, ReplicatedEntityCollection entityCollection) : base(world) { m_entityCollection = entityCollection; m_network = network; }
protected override void OnCreate() { networkServerSystem = World.GetOrCreateSystem <NetworkServerSystem>(); replicatedEntityCollection = new ReplicatedEntityCollection(EntityManager); }