Exemple #1
0
        public void Initialize(Unity.Entities.World space)
        {
            // stat bars
            cameraOrbitStartSystem = space.GetOrCreateSystem <CameraOrbitStartSystem>();
            AddSystemToUpdateList(cameraOrbitStartSystem);

            cameraSystem = space.GetOrCreateSystem <CameraSystem>();
            AddSystemToUpdateList(cameraSystem);

            cameraInputSystem = space.GetOrCreateSystem <CameraInputSystem>();
            AddSystemToUpdateList(cameraInputSystem);
            cameraMovementSystem = space.GetOrCreateSystem <CameraMovementSystem>();
            AddSystemToUpdateList(cameraMovementSystem);
            cameraFollowSystem = space.GetOrCreateSystem <CameraFollowSystem>();
            AddSystemToUpdateList(cameraFollowSystem);

            characterToCameraSystem = space.GetOrCreateSystem <CharacterToCameraSystem>();
            AddSystemToUpdateList(characterToCameraSystem);
            cameraFirstPersonSystem = space.GetOrCreateSystem <CameraFirstPersonSystem>();
            AddSystemToUpdateList(cameraFirstPersonSystem);
            cameraSynchSystem = space.GetOrCreateSystem <CameraSynchSystem>();
            AddSystemToUpdateList(cameraSynchSystem);

            //cameraProxySystem = space.GetOrCreateSystem<CameraProxySystem>();
            //AddSystemToUpdateList(cameraProxySystem);
            cameraOrbitSystem = space.GetOrCreateSystem <CameraOrbitSystem>();
            AddSystemToUpdateList(cameraOrbitSystem);
            cameraFacerSystem = space.GetOrCreateSystem <CameraFacerSystem>();
            AddSystemToUpdateList(cameraFacerSystem);
            SetLinks();
        }
Exemple #2
0
        public void Initialize(Unity.Entities.World space)
        {
            positionalForceSystem = space.GetOrCreateSystem <PositionalForceSystem>();
            rotationalForceSystem = space.GetOrCreateSystem <RotationalForceSystem>();
            AddSystemToUpdateList(positionalForceSystem);
            AddSystemToUpdateList(rotationalForceSystem);
            separationSystem = space.GetOrCreateSystem <SeparationSystem>();
            AddSystemToUpdateList(separationSystem);
            voxelCollisionSystem = space.GetOrCreateSystem <VoxelCollisionSystem>();
            AddSystemToUpdateList(voxelCollisionSystem);
            worldBoundSystem = space.GetOrCreateSystem <WorldBoundSystem>();
            AddSystemToUpdateList(worldBoundSystem);
            fallSystem = space.GetOrCreateSystem <FallSystem>();
            AddSystemToUpdateList(fallSystem);
            characterVoxelPositionSystem = space.GetOrCreateSystem <CharacterVoxelPositionSystem>();
            AddSystemToUpdateList(characterVoxelPositionSystem);

            //if (Bootstrap.DebugColliders)
            if (Bootstrap.instance != null && Bootstrap.instance.DebugColliders)
            {
                debugColliderSystem = space.GetOrCreateSystem <DebugColliderSystem>();
                AddSystemToUpdateList(debugColliderSystem);
                debugBoneSystem = space.GetOrCreateSystem <DebugBoneSystem>();
                AddSystemToUpdateList(debugBoneSystem);
            }
        }
Exemple #3
0
        public void Initialize(Unity.Entities.World space)
        {
            targetSystem        = space.GetOrCreateSystem <TargetSeekSystem>();
            aiStateSystem       = space.GetOrCreateSystem <AIStateSystem>();
            wanderSystem        = space.GetOrCreateSystem <WanderSystem>();
            moveToSystem        = space.GetOrCreateSystem <MoveToSystem>();
            rotateToSystem      = space.GetOrCreateSystem <RotateToSystem>();
            brainSystem         = space.GetOrCreateSystem <BrainSystem>();
            aimSystem           = space.GetOrCreateSystem <AimSystem>();
            followTargetSystem  = space.GetOrCreateSystem <FollowTargetSystem>();
            targetTrackerSystem = space.GetOrCreateSystem <TargetTrackerSystem>();
            AddSystemToUpdateList(targetTrackerSystem);

            AddSystemToUpdateList(targetSystem);
            AddSystemToUpdateList(aiStateSystem);
            AddSystemToUpdateList(wanderSystem);
            AddSystemToUpdateList(moveToSystem);
            AddSystemToUpdateList(rotateToSystem);
            AddSystemToUpdateList(brainSystem);
            AddSystemToUpdateList(aimSystem);
            AddSystemToUpdateList(followTargetSystem);

            nearbyCharactersSystem = space.GetOrCreateSystem <NearbyCharactersSystem>();
            AddSystemToUpdateList(nearbyCharactersSystem);
            SetLinks();
        }
        public void TestReadAndWriteWithObjectRef()
        {
            string binPath    = "Temp/test.bin";
            string binRefPath = "Temp/test.bin.ref";

            var dstWorld         = new World("");
            var dstEntitymanager = dstWorld.EntityManager;
            var material         = AssetDatabase.LoadAssetAtPath <Material>("Packages/com.unity.entities/Unity.Scenes.Hybrid.Tests/Test.mat");

            var entity = m_Manager.CreateEntity();

            m_Manager.AddComponentData(entity, new MaterialRefComponent {
                Value = material
            });
            m_Manager.AddComponentData(entity, new EcsTestData()
            {
                value = 5
            });

            EditorEntityScenes.Write(m_Manager, binPath, binRefPath);
            EditorEntityScenes.Read(dstEntitymanager, binPath, binRefPath);

            var dstEntity = dstEntitymanager.UniversalQuery.GetSingletonEntity();

            Assert.AreEqual(material, m_Manager.GetComponentData <MaterialRefComponent>(entity).Value);
            Assert.AreEqual(material, dstEntitymanager.GetComponentData <MaterialRefComponent>(dstEntity).Value);

            Assert.AreEqual(5, m_Manager.GetComponentData <EcsTestData>(entity).value);
            Assert.AreEqual(5, dstEntitymanager.GetComponentData <EcsTestData>(dstEntity).value);
        }
Exemple #5
0
 public SystemsManager(GameDatam data_, string worldName = "Zoxel")
 {
     space = CreateWorld(GetTypes(), worldName);
     data  = data_;
     // Core
     CreateSystemGroups();
     //SetSystems(false);
     SetData(data);
     SetSystems(true);
 }
Exemple #6
0
        public static Unity.Entities.World CreateEditorWorld(List <Type> types, string worldName)
        {
            var space = new Unity.Entities.World(worldName);

            //DefaultWorldInitialization.Initialize(worldName, false); // new Unity.Entities.World(worldName);
            DefaultWorldInitialization.AddSystemsToRootLevelSystemGroups(space, GetTypes());
            DefaultWorldInitialization.AddSystemsToRootLevelSystemGroups(space, GetUnityTypes());
            //Unity.Entities.World.DefaultGameObjectInjectionWorld = space;
            return(space);
        }
Exemple #7
0
 public void Initialize(Unity.Entities.World space)
 {
     characterSpawnSystem = space.GetOrCreateSystem <CharacterSpawnSystem>();
     characterDeathSystem = space.GetOrCreateSystem <CharacterDeathSystem>();
     turretSpawnSystem    = space.GetOrCreateSystem <TurretSpawnerSystem>();
     AddSystemToUpdateList(characterSpawnSystem);
     AddSystemToUpdateList(characterDeathSystem);
     AddSystemToUpdateList(turretSpawnSystem);
     SetLinks();
 }
Exemple #8
0
 void DestroyECS()
 {
     if (space != null)
     {
         space.GetOrCreateSystem <VoxelSystemGroup>().Clear();
         space.Dispose();
         space = null;
         EditorApplication.update -= UpdateEditorWindow;
         Repaint();
     }
 }
Exemple #9
0
 public void Initialize(Unity.Entities.World space)
 {
     bulletSpawnSystem        = space.GetOrCreateSystem <BulletSpawnSystem>();
     bulletDamageSystem       = space.GetOrCreateSystem <BulletHitSystem>();
     bulletHitCompleterSystem = space.GetOrCreateSystem <BulletHitCompleterSystem>();
     bulletDeathSystem        = space.GetOrCreateSystem <BulletDeathSystem>();
     bulletShrinkSystem       = space.GetOrCreateSystem <BulletShrinkSystem>();
     AddSystemToUpdateList(bulletSpawnSystem);
     AddSystemToUpdateList(bulletDamageSystem);
     AddSystemToUpdateList(bulletHitCompleterSystem);
     AddSystemToUpdateList(bulletDeathSystem);
     AddSystemToUpdateList(bulletShrinkSystem);
     SetLinks();
 }
Exemple #10
0
 public void Dispose()
 {
     if (space != null)
     {
         try
         {
             space.Dispose();
         }
         catch (ArgumentException e)
         {
             Debug.LogWarning(e.ToString());
         }
         space = null;
     }
 }
Exemple #11
0
 public void Initialize(Unity.Entities.World space)
 {
     skillsSystem         = space.GetOrCreateSystem <SkillsSystem>();
     damageSystem         = space.GetOrCreateSystem <DamageSystem>();
     shootSystem          = space.GetOrCreateSystem <ShootSystem>();
     shootCompleterSystem = space.GetOrCreateSystem <ShootCompleterSystem>();
     meleeDamageSystem    = space.GetOrCreateSystem <MeleeDamageSystem>();
     meleeCompleterSystem = space.GetOrCreateSystem <MeleeCompleterSystem>();
     AddSystemToUpdateList(skillsSystem);
     AddSystemToUpdateList(damageSystem);
     AddSystemToUpdateList(shootSystem);
     AddSystemToUpdateList(shootCompleterSystem);
     AddSystemToUpdateList(meleeDamageSystem);
     AddSystemToUpdateList(meleeCompleterSystem);
     SetLinks();
 }
Exemple #12
0
        void InitECS()
        {
            types = new List <Type>();
            types.Add(typeof(VoxelSystemGroup));
            types.Add(typeof(WorldSystemGroup));
            types.AddRange(SystemsManager.GetUnityTypes());
            space = SystemsManager.CreateEditorWorld(types, "MapMaker");
            var voxelSystemGroup = space.GetOrCreateSystem <VoxelSystemGroup>();
            var worldSystemGroup = space.GetOrCreateSystem <WorldSystemGroup>();

            worldSystemGroup.Initialize(space);
            voxelSystemGroup.Initialize(space);
            worldSystemGroup.CombineWithVoxels(voxelSystemGroup);
            voxelSystemGroup.SetMeta(gameData);
            Debug.Log("Adding Update Method from MapMaker.");
            EditorApplication.update += UpdateEditorWindow;
        }
Exemple #13
0
 public void Initialize(Unity.Entities.World space)
 {
     controllerSystem       = space.GetOrCreateSystem <ControllerSystem>();
     playerControllerSystem = space.GetOrCreateSystem <PlayerInputSystem>();
     playerSkillsSystem     = space.GetOrCreateSystem <PlayerSkillsSystem>();
     AddSystemToUpdateList(controllerSystem);
     AddSystemToUpdateList(playerControllerSystem);
     AddSystemToUpdateList(playerSkillsSystem);
     playerSpawnSystem = space.GetOrCreateSystem <PlayerSpawnSystem>();
     AddSystemToUpdateList(playerSpawnSystem);
     cursorStateSystem = space.GetOrCreateSystem <CursorStateSystem>();
     AddSystemToUpdateList(cursorStateSystem);
     gameUISystem = space.GetOrCreateSystem <GameUISystem>();
     AddSystemToUpdateList(gameUISystem);
     playerInteractSystem = space.GetOrCreateSystem <PlayerInteractSystem>();
     AddSystemToUpdateList(playerInteractSystem);
 }
Exemple #14
0
 public void Initialize(Unity.Entities.World space)
 {
     //regenStartSystem = space.GetOrCreateSystem<RegenStartSystem>();
     regenSystem          = space.GetOrCreateSystem <RegenSystem>();
     regenCompleterSystem = space.GetOrCreateSystem <RegenCompleterSystem>();
     levelUpSystem        = space.GetOrCreateSystem <LevelUpSystem>();
     levelUpEffectsSystem = space.GetOrCreateSystem <LevelUpEffectsSystem>();
     attributesSystem     = space.GetOrCreateSystem <AttributesSystem>();
     //AddSystemToUpdateList(regenStartSystem);
     AddSystemToUpdateList(regenSystem);
     AddSystemToUpdateList(regenCompleterSystem);
     AddSystemToUpdateList(levelUpSystem);
     AddSystemToUpdateList(levelUpEffectsSystem);
     AddSystemToUpdateList(attributesSystem);
     statUpdateSystem = space.GetOrCreateSystem <StatUpdateSystem>();
     AddSystemToUpdateList(statUpdateSystem);
     SetLinks();
 }
Exemple #15
0
        public void Initialize(Unity.Entities.World space)
        {
            itemSpawnSystem        = space.GetOrCreateSystem <ItemSpawnerSystem>();
            itemHitSystem          = space.GetOrCreateSystem <ItemHitSystem>();
            itemHitCompleterSystem = space.GetOrCreateSystem <ItemHitCompleterSystem>();
            itemBobSystem          = space.GetOrCreateSystem <ItemBobSystem>();
            AddSystemToUpdateList(itemSpawnSystem);
            AddSystemToUpdateList(itemHitSystem);
            AddSystemToUpdateList(itemHitCompleterSystem);
            AddSystemToUpdateList(itemBobSystem);
            equipmentSystem = space.GetOrCreateSystem <EquipmentSystem>();
            AddSystemToUpdateList(equipmentSystem);

            itemUISystem = space.GetOrCreateSystem <ItemUISystem>();
            AddSystemToUpdateList(itemUISystem);

            SetLinks();
        }
Exemple #16
0
 public void OnDisable()
 {
     Debug.Log("Removing Update Method from MapMaker.");
     EditorApplication.update -= UpdateEditorWindow;
     //ClearMap();
     //systemsManager.Clear();
     if (space != null)
     {
         if (space.IsCreated)
         {
             space.GetOrCreateSystem <VoxelSystemGroup>().Clear();
             space.Dispose();
         }
         space = null;
         //EditorApplication.update -= UpdateEditorWindow;
         //Repaint();
     }
 }
Exemple #17
0
 public void Initialize(Unity.Entities.World space)
 {
     biomeGenerationSystem = space.GetOrCreateSystem <BiomeGenerationSystem>();
     AddSystemToUpdateList(biomeGenerationSystem);
     heightMapGenerationSystem = space.GetOrCreateSystem <HeightMapGenerationSystem>();
     AddSystemToUpdateList(heightMapGenerationSystem);
     chunkMapBiomeBuilderSystem = space.GetOrCreateSystem <ChunkMapBiomeBuilderSystem>();
     AddSystemToUpdateList(chunkMapBiomeBuilderSystem);
     terrainGenerationSystem = space.GetOrCreateSystem <TerrainGenerationSystem>();
     AddSystemToUpdateList(terrainGenerationSystem);
     townGenerationSystem = space.GetOrCreateSystem <TownGenerationSystem>();
     AddSystemToUpdateList(townGenerationSystem);
     worldGenerationStarterSystem = space.GetOrCreateSystem <WorldGenerationStarterSystem>();
     AddSystemToUpdateList(worldGenerationStarterSystem);
     worldGenerationCompleterSystem = space.GetOrCreateSystem <WorldGenerationCompleterSystem>();
     AddSystemToUpdateList(worldGenerationCompleterSystem);
     if (!disableMonsterSpawning)
     {
         monsterSpawnSystem = space.GetOrCreateSystem <MonsterSpawnSystem>();
         AddSystemToUpdateList(monsterSpawnSystem);
     }
 }
Exemple #18
0
        private void InitECS()
        {
            if (space != null)
            {
                return;
            }
            types = new List <Type>();
            types.Add(typeof(VoxelSystemGroup));
            types.Add(typeof(WorldSystemGroup));
            types.AddRange(SystemsManager.GetUnityTypes());
            space = SystemsManager.CreateWorld(types, "Zaker");
            VoxelSystemGroup voxelSystemGroup = space.GetOrCreateSystem <VoxelSystemGroup>();
            WorldSystemGroup worldSystemGroup = space.GetOrCreateSystem <WorldSystemGroup>();

            worldSystemGroup.Initialize(space);
            voxelSystemGroup.Initialize(space);
            worldSystemGroup.CombineWithVoxels(voxelSystemGroup);
            voxelSystemGroup.SetMeta(gameDatam);
            EditorApplication.update += UpdateEditorWindow;
            // add camera systems
            // zoom into mesh
            // Add render texture of camera to this UI
        }
Exemple #19
0
        public void Initialize(Unity.Entities.World space)
        {
            sinRotatorSystem = space.CreateSystem <SinRotatorSystem>();
            AddSystemToUpdateList(sinRotatorSystem);

            animatorSystem           = space.GetOrCreateSystem <Zoxel.Animations.AnimatorSystem>();
            animatorEndSystem        = space.GetOrCreateSystem <Zoxel.Animations.AnimatorEndSystem>();
            shrinkSystem2            = space.GetOrCreateSystem <ShrinkSystem2>();
            shrinkSystem3            = space.GetOrCreateSystem <ShrinkSystem3>();
            lerpPositionSystem       = space.GetOrCreateSystem <LerpPositionSystem>();
            lerpScaleSystem          = space.GetOrCreateSystem <LerpScaleSystem>();
            lerpPositionEntitySystem = space.GetOrCreateSystem <LerpPositionEntitySystem>();
            doomedToDieSystem        = space.GetOrCreateSystem <DoomedToDieSystem>();
            AddSystemToUpdateList(animatorSystem);
            AddSystemToUpdateList(animatorEndSystem);
            AddSystemToUpdateList(shrinkSystem2);
            AddSystemToUpdateList(shrinkSystem3);
            AddSystemToUpdateList(lerpPositionSystem);
            AddSystemToUpdateList(lerpScaleSystem);
            AddSystemToUpdateList(lerpPositionEntitySystem);
            AddSystemToUpdateList(doomedToDieSystem);

            SetLinks();
        }
Exemple #20
0
        public static void InitializeSystems(World world)
        {
            var allSystemTypes = TypeManager.GetSystems();
            var allSystemNames = TypeManager.SystemNames;

            if (allSystemTypes.Length == 0)
            {
                throw new InvalidOperationException("DefaultTinyWorldInitialization: No Systems found.");
            }

            // Create top level presentation system and simulation systems.
            InitializationSystemGroup initializationSystemGroup = new InitializationSystemGroup();

            world.AddManager(initializationSystemGroup);

            SimulationSystemGroup simulationSystemGroup = new SimulationSystemGroup();

            world.AddManager(simulationSystemGroup);

            PresentationSystemGroup presentationSystemGroup = new PresentationSystemGroup();

            world.AddManager(presentationSystemGroup);

            // Create the working set of systems.
            int nSystems = 0;

            Type[]            systemTypes = new Type[allSystemTypes.Length];
            ComponentSystem[] systems     = new ComponentSystem[allSystemTypes.Length];

#if WRITE_LOG
            Console.WriteLine("--- Adding systems:");
#endif

            for (int i = 0; i < allSystemTypes.Length; i++)
            {
                if (TypeManager.GetSystemAttributes(allSystemTypes[i], typeof(DisableAutoCreationAttribute)).Length > 0)
                {
                    continue;
                }
                if (allSystemTypes[i] == initializationSystemGroup.GetType() ||
                    allSystemTypes[i] == simulationSystemGroup.GetType() ||
                    allSystemTypes[i] == presentationSystemGroup.GetType())
                {
                    continue;
                }

                if (world.GetExistingManager(allSystemTypes[i]) != null)
                {
                    continue;
                }
#if WRITE_LOG
                Console.WriteLine(allSystemNames[i]);
#endif
                systemTypes[nSystems] = allSystemTypes[i];
                systems[nSystems]     = TypeManager.ConstructSystem(allSystemTypes[i]);
                world.AddManager(systems[nSystems]);
                nSystems++;
            }
#if WRITE_LOG
            Console.WriteLine("--- Adding systems Done.");
#endif

            for (int i = 0; i < nSystems; ++i)
            {
                var sysType = systemTypes[i];
                var system  = systems[i];

                var groups = TypeManager.GetSystemAttributes(sysType, typeof(UpdateInGroupAttribute));
                if (groups.Length == 0)
                {
                    simulationSystemGroup.AddSystemToUpdateList(system);
                }

                for (int g = 0; g < groups.Length; ++g)
                {
                    var groupType   = groups[g] as UpdateInGroupAttribute;
                    var groupSystem = world.GetExistingManager(groupType.GroupType) as ComponentSystemGroup;
                    if (groupSystem == null)
                    {
                        throw new Exception("DefaultTinyWorldInitialization failed to find existing SystemGroup.");
                    }

                    groupSystem.AddSystemToUpdateList(system);
                }
            }
        }
Exemple #21
0
    private static Unity.Entities.World GetOrCreateWorld()
    {
        if (Unity.Entities.World.DefaultGameObjectInjectionWorld != null && Unity.Entities.World.DefaultGameObjectInjectionWorld.Name == "KodeboldsWorld")
        {
            return(Unity.Entities.World.DefaultGameObjectInjectionWorld);
        }

        Unity.Entities.World world = new Unity.Entities.World("KodeboldsWorld");
        Unity.Entities.World.DefaultGameObjectInjectionWorld = world;

        //INITIALISATION
        Unity.Entities.InitializationSystemGroup initSystemGroup = world.GetOrCreateSystem <Unity.Entities.InitializationSystemGroup>();

        initSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Entities.BeginInitializationEntityCommandBufferSystem>());
        initSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Entities.ConvertToEntitySystem>());
        initSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <CameraSyncSystem>());
        initSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <InputManagementSystem>());
        initSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <InstantiationSystem>());
        initSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <SpawningSystem>());
        initSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Entities.RetainBlobAssetSystem>());
        initSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Entities.UpdateWorldTimeSystem>());

        {
            Unity.Scenes.SceneSystemGroup sceneSystemGroup = world.GetOrCreateSystem <Unity.Scenes.SceneSystemGroup>();
            initSystemGroup.AddSystemToUpdateList(sceneSystemGroup);

            sceneSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Scenes.SceneSystem>());
            sceneSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Scenes.ResolveSceneReferenceSystem>());
            sceneSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Scenes.SceneSectionStreamingSystem>());
        }

        initSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Transforms.CopyInitialTransformFromGameObjectSystem>());

        //Must run after CopyInitialTransformFromGameObjectSystem.
        initSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <FreezeRotationSystem>());

        initSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Entities.EndInitializationEntityCommandBufferSystem>());

        //SIMULATION
        Unity.Entities.SimulationSystemGroup simSystemGroup = world.GetOrCreateSystem <Unity.Entities.SimulationSystemGroup>();


        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Entities.BeginSimulationEntityCommandBufferSystem>());
        //simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem<DebugStream>()); //Unity system, they just didn't put it in a namespace hurr durr.
        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Physics.Systems.BuildPhysicsWorld>());
        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Physics.Authoring.DisplayJointsSystem>());
        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Physics.Systems.StepPhysicsWorld>());
        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Physics.Systems.ExportPhysicsWorld>());
        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Physics.Authoring.DisplayContactsSystem>());
        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Physics.Authoring.DisplayBroadphaseAabbsSystem>());
        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Physics.Authoring.DisplayColliderAabbsSystem>());
        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Physics.Authoring.DisplayBodyColliders>());
        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Physics.Authoring.DisplayCollisionEventsSystem>());
        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Physics.Authoring.DisplayContactsSystem>());
        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Physics.Authoring.DisplayMassPropertiesSystem>());
        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Physics.Authoring.DisplayTriggerEventsSystem>());
        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Physics.Systems.EndFramePhysicsSystem>());

        {
            PostPhysicsSystemsGroup postPhysicsSystemsGroup = world.GetOrCreateSystem <PostPhysicsSystemsGroup>();
            simSystemGroup.AddSystemToUpdateList(postPhysicsSystemsGroup);

            postPhysicsSystemsGroup.AddSystemToUpdateList(world.GetOrCreateSystem <RaycastSystem>());
            postPhysicsSystemsGroup.AddSystemToUpdateList(world.GetOrCreateSystem <SpawningQueueSystem>());
            postPhysicsSystemsGroup.AddSystemToUpdateList(world.GetOrCreateSystem <SelectionSystem>());
            postPhysicsSystemsGroup.AddSystemToUpdateList(world.GetOrCreateSystem <CameraControlSystem>());
            postPhysicsSystemsGroup.AddSystemToUpdateList(world.GetOrCreateSystem <HarvestingSystem>());
            postPhysicsSystemsGroup.AddSystemToUpdateList(world.GetOrCreateSystem <DepositSystem>());
            postPhysicsSystemsGroup.AddSystemToUpdateList(world.GetOrCreateSystem <UnitMoveSystem>());
        }

        {
            //These systems must be updated after all the game logic systems as state transitions add/remove components via an entity command buffer, meaning the command status data
            //will be out of sync with the state components until the next sync point (command buffer system).
            //We do this step at the end to avoid an additional sync point that would halt the main thread.
            CommandStateProcessingSystemsGroup commandStateProcessingSystemsGroup = world.GetOrCreateSystem <CommandStateProcessingSystemsGroup>();
            simSystemGroup.AddSystemToUpdateList(commandStateProcessingSystemsGroup);

            commandStateProcessingSystemsGroup.AddSystemToUpdateList(world.GetOrCreateSystem <FindAITargetSystem>());
            commandStateProcessingSystemsGroup.AddSystemToUpdateList(world.GetOrCreateSystem <CommandProcessSystem>());
            commandStateProcessingSystemsGroup.AddSystemToUpdateList(world.GetOrCreateSystem <StateTransitionSystem>());
        }

        {
            Unity.Transforms.TransformSystemGroup transformSystemGroup = world.GetOrCreateSystem <Unity.Transforms.TransformSystemGroup>();
            simSystemGroup.AddSystemToUpdateList(transformSystemGroup);

            transformSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Transforms.CopyTransformFromGameObjectSystem>());
            transformSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Transforms.EndFrameCompositeScaleSystem>());
            transformSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Transforms.EndFrameParentSystem>());
            transformSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Transforms.EndFramePostRotationEulerSystem>());
            transformSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Transforms.EndFrameRotationEulerSystem>());
            transformSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Transforms.EndFrameCompositeRotationSystem>());
            transformSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Transforms.EndFrameParentScaleInverseSystem>());
            transformSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Transforms.EndFrameTRSToLocalToParentSystem>());
            transformSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Transforms.EndFrameTRSToLocalToWorldSystem>());
            transformSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Transforms.EndFrameLocalToParentSystem>());
            transformSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Transforms.CopyTransformToGameObjectSystem>());
            transformSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Transforms.EndFrameWorldToLocalSystem>());
        }

        {
            BehaviourUpdaterSystemsGroup behaviourUpdaterSystemsGroup = world.GetOrCreateSystem <BehaviourUpdaterSystemsGroup>();
            simSystemGroup.AddSystemToUpdateList(behaviourUpdaterSystemsGroup);

            m_behaviourUpdaterSystem = world.GetOrCreateSystem <BehaviourUpdaterSystem>();

            behaviourUpdaterSystemsGroup.AddSystemToUpdateList(m_behaviourUpdaterSystem);
        }

        simSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Entities.EndSimulationEntityCommandBufferSystem>());


        //PRESENTATION
        Unity.Entities.PresentationSystemGroup presentationSystemGroup = world.GetOrCreateSystem <Unity.Entities.PresentationSystemGroup>();

        presentationSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Entities.BeginPresentationEntityCommandBufferSystem>());

        {
            Unity.Rendering.StructuralChangePresentationSystemGroup structuralChangePresentationSystemGroup = world.GetOrCreateSystem <Unity.Rendering.StructuralChangePresentationSystemGroup>();
            presentationSystemGroup.AddSystemToUpdateList(structuralChangePresentationSystemGroup);

            structuralChangePresentationSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Rendering.AddWorldAndChunkRenderBounds>());
            structuralChangePresentationSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Rendering.AddLodRequirementComponents>());
        }

        {
            Unity.Rendering.UpdatePresentationSystemGroup updatePresentationSystemGroup = world.GetOrCreateSystem <Unity.Rendering.UpdatePresentationSystemGroup>();
            presentationSystemGroup.AddSystemToUpdateList(updatePresentationSystemGroup);

            updatePresentationSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Rendering.RenderBoundsUpdateSystem>());
            updatePresentationSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Rendering.LodRequirementsUpdateSystem>());
        }

        presentationSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <Unity.Rendering.RenderMeshSystemV2>());
        presentationSystemGroup.AddSystemToUpdateList(world.GetOrCreateSystem <EndFrameJobCompleteSystem>());

        Unity.Entities.ScriptBehaviourUpdateOrder.UpdatePlayerLoop(world);

        return(world);
    }
 internal sealed override void OnBeforeCreateInternal(World world)
 {
     base.OnBeforeCreateInternal(world);
 }
Exemple #23
0
        public void Initialize(Unity.Entities.World space)
        {
            // stat bars
            statbarSystem = space.GetOrCreateSystem <StatbarSystem>();
            AddSystemToUpdateList(statbarSystem);
            statBarSystem = space.GetOrCreateSystem <StatbarPositionerSystem>();
            AddSystemToUpdateList(statBarSystem);
            statbarUpdateSystem = space.GetOrCreateSystem <StatBarUpdaterSystem>();
            AddSystemToUpdateList(statbarUpdateSystem);
            trailerPositionerSystem = space.GetOrCreateSystem <TrailerPositionerSystem>();
            AddSystemToUpdateList(trailerPositionerSystem);
            trailerStarterSystem = space.GetOrCreateSystem <TrailerStarterSystem>();
            AddSystemToUpdateList(trailerStarterSystem);
            statbarFaderSystem = space.GetOrCreateSystem <StatBarFaderSystem>();
            AddSystemToUpdateList(statbarFaderSystem);
            damagePopupSystem = space.GetOrCreateSystem <DamagePopupSystem>();
            AddSystemToUpdateList(damagePopupSystem);
            navigateUISystem = space.GetOrCreateSystem <NavigateUISystem>();
            AddSystemToUpdateList(navigateUISystem);
            navigateUICompleterSystem = space.GetOrCreateSystem <NavigateUICompleterSystem>();
            AddSystemToUpdateList(navigateUICompleterSystem);
            gridUISystem = space.GetOrCreateSystem <GridUISystem>();
            AddSystemToUpdateList(gridUISystem);
            navigateStartSystem = space.GetOrCreateSystem <NavigateStartSystem>();
            AddSystemToUpdateList(navigateStartSystem);


            selectedUISystem = space.GetOrCreateSystem <SelectedUISystem>();
            AddSystemToUpdateList(selectedUISystem);
            panelUISystem = space.GetOrCreateSystem <PanelUISystem>();
            AddSystemToUpdateList(panelUISystem);

            // Player UIs
            crosshairSpawnSystem = space.GetOrCreateSystem <CrosshairSpawnSystem>();
            AddSystemToUpdateList(crosshairSpawnSystem);
            actionbarSpawnSystem = space.GetOrCreateSystem <ActionbarSystem>();
            AddSystemToUpdateList(actionbarSpawnSystem);
            inventoryUISpawnSystem = space.GetOrCreateSystem <InventoryUISpawnSystem>();
            AddSystemToUpdateList(inventoryUISpawnSystem);
            equipmentUISpawnSystem = space.GetOrCreateSystem <EquipmentUISpawnSystem>();
            AddSystemToUpdateList(equipmentUISpawnSystem);

            statsUISpawnSystem = space.GetOrCreateSystem <StatsUISpawnSystem>();
            AddSystemToUpdateList(statsUISpawnSystem);

            skillbookUISpawnSystem = space.GetOrCreateSystem <SkillbookUISpawnSystem>();
            AddSystemToUpdateList(skillbookUISpawnSystem);

            dialogueUISpawnSystem = space.GetOrCreateSystem <DialogueUISpawnSystem>();
            AddSystemToUpdateList(dialogueUISpawnSystem);
            dialogueSystem = space.GetOrCreateSystem <DialogueSystem>();
            AddSystemToUpdateList(dialogueSystem);
            questLogUISpawnSystem = space.GetOrCreateSystem <QuestLogUISpawnSystem>();
            AddSystemToUpdateList(questLogUISpawnSystem);
            menuSpawnSystem = space.GetOrCreateSystem <MenuSpawnSystem>();
            AddSystemToUpdateList(menuSpawnSystem);
            renderTextSystem = space.GetOrCreateSystem <RenderTextSystem>();
            AddSystemToUpdateList(renderTextSystem);
            mapUISpawnSystem = space.GetOrCreateSystem <MapUISpawnSystem>();
            AddSystemToUpdateList(mapUISpawnSystem);

            SetLinks();
        }
 public ComponentReplicator(EntityManager entityManager, Unity.Entities.World world) : base(entityManager)
 {
     var bookkeepingSystem = world.GetOrCreateManager <CommandRequestTrackerSystem>();
 }
Exemple #25
0
        public void Initialize(Unity.Entities.World space)
        {
            // entity spawn
            worldSpawnSystem = space.GetOrCreateSystem <WorldSpawnSystem>();
            AddSystemToUpdateList(worldSpawnSystem);
            chunkSpawnSystem = space.GetOrCreateSystem <ChunkSpawnSystem>();
            AddSystemToUpdateList(chunkSpawnSystem);
            chunkRenderSystem = space.GetOrCreateSystem <ChunkRenderSystem>();
            AddSystemToUpdateList(chunkRenderSystem);
            voxelSpawnSystem = space.GetOrCreateSystem <VoxelSpawnSystem>();
            AddSystemToUpdateList(voxelSpawnSystem);

            // mesh gen
            chunkSideSystem = space.GetOrCreateSystem <ChunkSidesSystem>();
            AddSystemToUpdateList(chunkSideSystem);
            chunkSideCullSystem = space.GetOrCreateSystem <ChunkSideCullingSystem>();
            AddSystemToUpdateList(chunkSideCullSystem);
            chunkToRendererSystem = space.GetOrCreateSystem <ChunkToRendererSystem>();
            AddSystemToUpdateList(chunkToRendererSystem);
            chunkMeshBuildSystem = space.GetOrCreateSystem <ChunkMeshBuilderSystem>();
            AddSystemToUpdateList(chunkMeshBuildSystem);
            chunkMeshEndSystem = space.GetOrCreateSystem <ChunkMeshEndingSystem>();
            AddSystemToUpdateList(chunkMeshEndSystem);

            chunkWeightBuilder = space.GetOrCreateSystem <ChunkWeightBuilder>();
            AddSystemToUpdateList(chunkWeightBuilder);

            // maps
            chunkMapStarterSystem = space.GetOrCreateSystem <ChunkMapStarterSystem>();
            AddSystemToUpdateList(chunkMapStarterSystem);
            chunkMapBuilderSystem = space.GetOrCreateSystem <ChunkMapBuilderSystem>();
            AddSystemToUpdateList(chunkMapBuilderSystem);
            chunkMapCompleterSystem = space.GetOrCreateSystem <ChunkMapCompleterSystem>();
            AddSystemToUpdateList(chunkMapCompleterSystem);

            // player streaming
            worldStreamSystem = space.GetOrCreateSystem <WorldStreamSystem>();
            AddSystemToUpdateList(worldStreamSystem);
            chunkStreamSystem = space.GetOrCreateSystem <ChunkStreamSystem>();
            AddSystemToUpdateList(chunkStreamSystem);
            chunkStreamEndSystem = space.GetOrCreateSystem <ChunkStreamEndSystem>();
            AddSystemToUpdateList(chunkStreamEndSystem);

            // interact
            voxelRaycastSystem = space.GetOrCreateSystem <VoxelRaycastSystem>();
            AddSystemToUpdateList(voxelRaycastSystem);
            voxelPreviewSystem = space.GetOrCreateSystem <VoxelPreviewSystem>();
            AddSystemToUpdateList(voxelPreviewSystem);
            characterRaycastSystem = space.GetOrCreateSystem <CharacterRaycastSystem>();
            AddSystemToUpdateList(characterRaycastSystem);

            renderSystem = space.GetOrCreateSystem <RenderSystem>();
            AddSystemToUpdateList(renderSystem);

            if (Bootstrap.instance.isAnimateRenders)
            {
                chunkRendererAnimationSystem = space.GetOrCreateSystem <ChunkRendererAnimationSystem>();
                AddSystemToUpdateList(chunkRendererAnimationSystem);
            }

            if (Bootstrap.DebugChunks)
            {
                debugChunkSystem = space.GetOrCreateSystem <DebugChunkSystem>();
                AddSystemToUpdateList(debugChunkSystem);
            }
            if (!Bootstrap.isRenderChunks)
            {
                chunkSideSystem.Enabled = false;
            }
            SetLinks();
        }