protected override void OnCreate()
        {
            ConfigVar.Init();

            var commandLineArgs = Environment.GetCommandLineArgs();
            foreach (var commandLine in commandLineArgs)
            {
                if(commandLine.StartsWith("-Port:"))
                    NetworkConfig.serverPort.Value = commandLine.Substring(6);
                FSLog.Info($"commandLineArgs:{commandLine}");
            }
        

            ItemCreateUtilities.Init();

            GameWorld.Active = new GameWorld();
            UnityEngine.Time.fixedDeltaTime = GameTick.DefaultGameTick.TickInterval;

            EntityManager.CreateEntity(typeof(Server));
            SetSingleton(new Server());

            m_systemsToUpdate.Add(World.GetOrCreateSystem<WorldSceneEntitiesSystem>());
            networkServerSystem = World.GetOrCreateSystem<NetworkServerSystem>();

            m_systemsToUpdate.Add(World.GetOrCreateSystem<ReplicateEntityServerSystem>());
            m_systemsToUpdate.Add(World.GetOrCreateSystem<HandleCommandsSystem>());

            m_systemsToUpdate.Add(World.GetOrCreateSystem<InitSystemGroup>());
            m_systemsToUpdate.Add(World.GetOrCreateSystem<SpawnPlayerServerSystem>());
            m_systemsToUpdate.Add(World.GetOrCreateSystem<SpawnRobotsSystem>());
            m_systemsToUpdate.Add(World.GetOrCreateSystem<SpawnSystemGroup>());

            m_systemsToUpdate.Add(World.GetOrCreateSystem<RegisterEntityToNetwork>());

            m_systemsToUpdate.Add(World.GetOrCreateSystem<PrintGameStateSystem>());
            m_systemsToUpdate.Add(World.GetOrCreateSystem<RobotsControlSystem>());
            m_systemsToUpdate.Add(World.GetOrCreateSystem<UpdateReplicatedOwnerFlag>());

            m_systemsToUpdate.Add(World.GetOrCreateSystem<PredictUpdateSystemGroup>());
            m_systemsToUpdate.Add(World.GetOrCreateSystem<ServerSystemGroup>());

            m_systemsToUpdate.Add(World.GetOrCreateSystem<PredictPresentationSystemGroup>());
            
            m_systemsToUpdate.Add(World.GetOrCreateSystem<DespawnServerSystem>());
            m_systemsToUpdate.Add(World.GetOrCreateSystem<DespawnCharacterSystem>());
            m_systemsToUpdate.Add(World.GetOrCreateSystem<DespawnItemOwnerSystem>());
            m_systemsToUpdate.Add(World.GetOrCreateSystem<DespawnSystem>());            
        }
Beispiel #2
0
        protected override void OnCreate()
        {
            var entity = EntityManager.CreateEntity(typeof(SpawnPlayerServer));

            SetSingleton(new SpawnPlayerServer());
            EntityManager.AddBuffer <SpawnPlayerBuffer>(entity);

            playerPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(
                Resources.Load("Character/CharacterEntity") as GameObject,
                GameObjectConversionSettings.FromWorld(World,
                                                       World.DefaultGameObjectInjectionWorld.GetOrCreateSystem <ConvertToEntitySystem>().BlobAssetStore));

            networkServerSystem = World.GetOrCreateSystem <NetworkServerSystem>();

            spawnPointQuery = EntityManager.CreateEntityQuery(typeof(SpawnPoint));

            m_BuildPhysicsWorldSystem = World.GetOrCreateSystem <KitchenBuildPhysicsWorld>();

            random = new Unity.Mathematics.Random(20);
        }
Beispiel #3
0
 protected override void OnCreate()
 {
     networkServerSystem = World.GetOrCreateSystem <NetworkServerSystem>();
 }
 protected override void OnCreate()
 {
     networkServerSystem        = World.GetOrCreateSystem <NetworkServerSystem>();
     replicatedEntityCollection = new ReplicatedEntityCollection(EntityManager);
 }