protected override void OnCreate()
        {
            _barrier = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

            _gameTurnEntity = EntityManager.CreateEntity(
                typeof(GameTurn)
                );

#if UNITY_EDITOR
            EntityManager.SetName(_gameTurnEntity, "TurnManagerEntity");
#endif

            // Add our game turns
            AddGameTurn <PlayerTurn>();
            AddGameTurn <EnemyTurn>();
        }
        protected override void OnCreate()
        {
            base.OnCreate();
            var agentQueryDesc = new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    typeof(NavAgent),
                    typeof(EnemyTag)
                }
            };

            _agentQuery = GetEntityQuery(agentQueryDesc);

            _endSimulationEntityCommandBufferSystem = World.DefaultGameObjectInjectionWorld.GetExistingSystem <EndSimulationEntityCommandBufferSystem>();
        }
Exemplo n.º 3
0
 protected override void OnCreate()
 {
     this.CurrentPhase     = 0;
     this._endFrameBarrier = World.Active.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
     this._boardGroup      = this.GetEntityQuery(new EntityQueryDesc
     {
         All = new ComponentType[]
         {
             typeof(BoardComponent)
         },
         None = new ComponentType[]
         {
             typeof(BoardReadyComponent)
         }
     });
 }
Exemplo n.º 4
0
        protected override void OnCreate()
        {
            base.OnCreate();

            _mapQuery = GetEntityQuery(
                ComponentType.ReadWrite <MapState>(),
                ComponentType.ReadOnly <MapTiles>()
                );

            _actorQuery = GetEntityQuery(
                typeof(Collidable),
                typeof(CollidableStateComponent)
                );

            _endSimBarrier = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
        }
Exemplo n.º 5
0
    protected override void OnCreate()
    {
        commandBufferSystem      = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
        addContMovementQueryDesc = new EntityQueryDesc { // define query for adding constant movement components
            All = new ComponentType[] {
                ComponentType.ReadOnly <Translation>(),
                ComponentType.ReadOnly <PoliceUnitComponent>(),
                ComponentType.ReadOnly <SelectedPoliceUnit>()
            }
        };



        base.OnCreate();
        this.Enabled = false;
    }
Exemplo n.º 6
0
        protected override void OnCreate()
        {
            _barrier = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

            _generateMapQuery = GetEntityQuery(
                ComponentType.ReadOnly <GenerateMap>(),
                ComponentType.ReadOnly <MapData>(),
                ComponentType.ReadWrite <MapTiles>()
                );

            _playerQuery = GetEntityQuery(
                ComponentType.ReadOnly <Player>(),
                ComponentType.ReadWrite <Position>());

            RequireForUpdate(_generateMapQuery);
        }
Exemplo n.º 7
0
        protected override void OnCreate()
        {
            base.OnCreate();
            var queryDesc = new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    typeof(Player),
                    typeof(Status)
                }
            };

            _statusQuery = EntityManager.CreateEntityQuery(queryDesc);

            _entityCommandBufferSystem = World.GetExistingSystem <EndSimulationEntityCommandBufferSystem>();
        }
Exemplo n.º 8
0
        protected override void OnUpdate()
        {
            EndSimulationEntityCommandBufferSystem endSimECBSystem =
                World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

            DestroyJob job = new DestroyJob
            {
                EntityType         = GetEntityTypeHandle(),
                InfoType           = GetComponentTypeHandle <TTweenInfo>(true),
                TweenBufferType    = GetBufferTypeHandle <TweenState>(),
                DestroyCommandType = GetBufferTypeHandle <TweenDestroyCommand>(),
                ParallelWriter     = endSimECBSystem.CreateCommandBuffer().AsParallelWriter(),
            };

            Dependency = job.ScheduleParallel(TweenInfoQuery, Dependency);
            endSimECBSystem.AddJobHandleForProducer(Dependency);
        }
        protected override void OnCreate()
        {
            BufferSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
            //ShieldMaterial = (Material)AssetDatabase.LoadAssetAtPath("Assets/Art/Effects/Shields/ShieldMaterial.mat", typeof(Material));
            ShieldMaterial = Resources.Load <Material>("ShieldMaterial");
            //Mesh = (Mesh)AssetDatabase.LoadAssetAtPath("Assets/Art/Misc/ScalePlane.fbx", typeof(Mesh));
            Mesh = Resources.Load <Mesh>("ScalePlane");

            if (Mesh == null)
            {
                throw new System.Exception("Could not load mesh.");
            }
            if (ShieldMaterial == null)
            {
                throw new System.Exception("Could not load shield material.");
            }
        }
Exemplo n.º 10
0
    protected override void OnCreate()
    {
        blockQuery = EntityManager.CreateEntityQuery(ComponentType.ReadOnly <BlockTag>());
        ballQuery  = EntityManager.CreateEntityQuery(ComponentType.ReadOnly <BallTag>());

        stepPhysicsWorld = World.GetOrCreateSystem <StepPhysicsWorld>();
        increaseVelocityOverTimeSystem         = World.GetOrCreateSystem <IncreaseVelocityOverTimeSystem>();
        endSimulationEntityCommandBufferSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

        // Create Ball Entity.
        var ballPrefab = Resources.Load <GameObject>("Ball");

        blobAssetStore = new BlobAssetStore();
        var settings = GameObjectConversionSettings.FromWorld(World, blobAssetStore);

        ball = GameObjectConversionUtility.ConvertGameObjectHierarchy(ballPrefab, settings);
    }
Exemplo n.º 11
0
        protected override void OnCreate()
        {
            _barrierSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

            _mapQuery = GetEntityQuery(
                ComponentType.ReadOnly <MapInput>(),
                ComponentType.ReadWrite <MapData>()
                );

            _controls = new TutorialControls();
            _controls.Enable();

            _generateMapAction = _controls.DefaultMapping.GenerateMap;
            _resizeMapAction   = _controls.DefaultMapping.ResizeMap;

            RequireForUpdate(_mapQuery);
        }
Exemplo n.º 12
0
 protected override void OnCreate()
 {
     m_endEcbSystem       = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
     m_beginEcbSystem     = World.GetOrCreateSystem <BeginSimulationEntityCommandBufferSystem>();
     m_onActSelectedGroup = GetEntityQuery(new EntityQueryDesc
     {
         All = new ComponentType[]
         {
             ComponentType.ReadOnly <ActionInfo>(),
             ComponentType.ReadOnly <OnActionSelected>(),
         },
         Any = new ComponentType[]
         {
             ComponentType.ReadOnly <NotRequireNavigation>()
         }
     });
 }
    protected override void OnCreate()
    {
        commandBufferSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

        beginCountQueryDesc = new EntityQueryDesc {
            All = new ComponentType[] {
                ComponentType.ReadOnly <CrowdCollidedWithPolice>(),
                ComponentType.ReadOnly <Crowd>()
            },
            None = new ComponentType[] {
                ComponentType.ReadOnly <CountUntilLeave>(),
                ComponentType.ReadOnly <GoHomeAction>()
            },
        };

        base.OnCreate();
    }
Exemplo n.º 14
0
 protected override void OnCreate()
 {
     m_Group = GetEntityQuery(ComponentType.ReadWrite <EnergyStore>(),
                              ComponentType.ReadWrite <TxAutotrophPhenotype>(),
                              ComponentType.ReadWrite <Scale>(),
                              ComponentType.ReadOnly <TxAutotrophChrome1W>(),
                              ComponentType.ReadOnly <TxAutotrophParts>(),
                              ComponentType.ReadOnly <Translation>()
                              );
     petalGroup = GetEntityQuery(
         ComponentType.ReadWrite <Translation>(),
         ComponentType.ReadWrite <Scale>(),
         ComponentType.ReadOnly <TxAutotrophPetal>()
         );
     m_EndSimulationEcbSystem = World
                                .GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
 }
        // Run some tests to see what kind of differences there are from entity spawning techniques
        // As expected Burst operations in parallel get the biggest gains especially when manipulating
        // 1000s or more entities each frame

        protected override void OnUpdate()
        {
            EntityManager.AddComponentData <PrefabEntityExtraData>(PrefabEntitiesV2.preFabEntity,
                                                                   new PrefabEntityExtraData
            {
                ttl      = 0f,
                velocity = new float3(0, 0, 0)
            });

            Entity preFabEntity = PrefabEntitiesV2.preFabEntity;


            // Command Buffer is needed to destroy entities.
            EndSimulationEntityCommandBufferSystem escbs = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

            float gravity     = 9.8f;
            float ttl         = settings.ttl;
            float spawnRate   = settings.spawnRate;
            int   mode        = settings.method;
            int   destroyMode = settings.destroyMode;

            // Spawn entities based on Spawn Rate per second

            float currTime = Time.DeltaTime;

            lastSpawnTime += Time.DeltaTime;
            int toSpawn = (int)(spawnRate * lastSpawnTime);

            if (toSpawn >= 1)
            {
                lastSpawnTime = 0;

                // Method that Instantiates all Entities first then sets a random location for them
                // Fastest method of the four
                // Note:  The instantiation is still the most expensive operaton
                SpawnEntities(mode, preFabEntity, toSpawn, ttl);
            }


            // Apply Gravity
            ApplyGravityParallel(gravity, currTime);


            // Update the TTL and destroy if necessary
            CalculateTTLAndDestroy(destroyMode, escbs, currTime);
        }
Exemplo n.º 16
0
    protected override void OnCreate()
    {
        base.OnCreate();
        m_GraphSystem = World.GetOrCreateSystem <ProcessDefaultAnimationGraph>();
        // Increase the reference count on the graph system so it knows
        // that we want to use it.
        m_GraphSystem.AddRef();
        m_ECBSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

        m_AnimationDataQuery = GetEntityQuery(new EntityQueryDesc()
        {
            None = new ComponentType[] { typeof(RotatingCube_PlayClipComponent) },
            All  = new ComponentType[] { typeof(RotatingCube_PlayClipStateComponent) }
        });

        m_GraphSystem.Set.RendererModel = NodeSet.RenderExecutionModel.Islands;
    }
    protected override void OnCreate()
    {
        //base.OnCreate();

        m_EndSimulationEcbSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

        m_EntityCommandBufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();

        _heroesQuery  = GetEntityQuery(typeof(HerosArchetype), ComponentType.ReadOnly <MoveStats>(), ComponentType.ReadOnly <SouffleDeFeuStats>(), ComponentType.ReadWrite <AbilityStats>(), ComponentType.ReadOnly <AbilityPerform>());
        _souffleDeFeu = EntityManager.CreateArchetype(
            typeof(HashRegion),
            typeof(SouffleDeFeuTemp)
            );

        _query      = GetEntityQuery(typeof(SouffleDeFeuTemp));
        _queryInput = GetEntityQuery(typeof(InputComponent));
    }
Exemplo n.º 18
0
    protected override void OnCreate()
    {
        m_EntityCommandBufferSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

        var query = new EntityQueryDesc
        {
            //None = new ComponentType[] {typeof(LbArrow)},
            All = new ComponentType[] { typeof(LbPlayer), typeof(LbArrowPosition), typeof(LbArrow) }
        };

        m_PlayerQuery = GetEntityQuery(query);

        m_BoardQuery = GetEntityQuery(typeof(LbBoard));

        _random = new Random();
        _random.InitState();
    }
Exemplo n.º 19
0
        protected override void OnCreate()
        {
            base.OnCreate();
            m_EndSimSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
            m_HealthQuery  = GetEntityQuery(new EntityQueryDesc
            {
                All = new ComponentType[]
                {
                    ComponentType.ReadWrite <Health>()
                },

                None = new ComponentType[]
                {
                    typeof(DamageStack)
                }
            });
        }
Exemplo n.º 20
0
 protected override void OnCreateManager()
 {
     _endBarrier = World.GetOrCreateManager <EndSimulationEntityCommandBufferSystem>();
     _tweens     = GetComponentGroup(new EntityArchetypeQuery
     {
         All = new[] {
             ComponentType.ReadOnly <TweenComplitedState>(),
             ComponentType.ReadOnly <TweenLoopTime>(),
             ComponentType.ReadOnly <TweenProgress>()
         },
         None = new[]
         {
             ComponentType.ReadOnly <DestroyOnComplite>(),
             ComponentType.ReadOnly <TweenSpeed>(),
             ComponentType.ReadOnly <TweenFloat3Speed>()
         }
     });
 }
Exemplo n.º 21
0
        protected override void OnCreate()
        {
            base.OnCreate();

            prefab = Resources.Load("Prefabs/ProceduralGeneration/ProceduralGenerationPrefab") as GameObject;
            if (prefab == null)
            {
                Debug.LogError("Failed to load Prefab!");
            }

            // Find the ECB system once and store it for later usage
            m_EndSimulationEcbSystem = World
                                       .GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

            spawnQuery = EntityManager.CreateEntityQuery(typeof(PGDS));

            InitilizeIDArrays();
        }
Exemplo n.º 22
0
        //--------------------------------------------------------------------------------------------------------------------------
        #region LifeCycle

        protected override void OnCreate()
        {
            timeJob = new TimeChunkJob()
            {
            };

            activeTimesQuery = GetEntityQuery(new EntityQueryDesc()
            {
                Any = new ComponentType[]
                {
                    ComponentType.ReadWrite <DeltaTime>(),
                    ComponentType.ReadWrite <ElapsedTime>(),
                    ComponentType.ReadWrite <FixedTimeStep>()
                },
            });

            endSimCBS = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
        }
Exemplo n.º 23
0
        protected override void OnCreate()
        {
            shipGroup = GetEntityQuery(ComponentType.ReadOnly <Translation>(),
                                       ComponentType.ReadOnly <CollisionSphereComponent>(), ComponentType.ReadOnly <ShipTagComponentData>());
            bulletGroup = GetEntityQuery(ComponentType.ReadOnly <Translation>(),
                                         ComponentType.ReadOnly <CollisionSphereComponent>(), ComponentType.ReadOnly <BulletTagComponent>(),
                                         ComponentType.ReadOnly <BulletAgeComponent>());
            asteroidGroup = GetEntityQuery(ComponentType.ReadOnly <Translation>(),
                                           ComponentType.ReadOnly <CollisionSphereComponent>(), ComponentType.ReadOnly <AsteroidTagComponentData>());
            barrier = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
            m_ServerSimulationSystemGroup = World.GetExistingSystem <ServerSimulationSystemGroup>();
            playerClearQueue = new NativeQueue <Entity>(Allocator.Persistent);

            m_LevelGroup = GetEntityQuery(ComponentType.ReadWrite <LevelComponent>());
            RequireForUpdate(m_LevelGroup);

            settingsGroup = GetEntityQuery(ComponentType.ReadOnly <ServerSettings>());
        }
Exemplo n.º 24
0
 protected override void OnCreate()
 {
     commandBufferSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
     goHomeQueryDec      = new EntityQueryDesc {
         All = new ComponentType[] {
             ComponentType.ReadOnly <Action>(),
             ComponentType.ReadOnly <Translation>(),
             ComponentType.ReadOnly <GoHomeAction>(),
             ComponentType.ReadOnly <HasReynoldsSeekTargetPos>()
         },
         None = new ComponentType[] { // don't go home if the information is being stored/changed
             typeof(StoreWayPoints),
             typeof(ChangeAction),
             typeof(RemoveAction)
         }
     };
     base.OnCreate();
 }
    protected override void OnCreate()
    {
        mainCamera   = Camera.main;
        lastbuildPos = mainCamera.transform.position;
        endSimulationEntityCommandBufferSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

        m_Query = GetEntityQuery(typeof(UltraChunk));

        bm = new BoxGeometry
        {
            BevelRadius = 0f,
            Center      = new float3(float3.zero - 0.5f),
            Orientation = quaternion.identity,
            Size        = new float3(MeshComponents.chunkSize)
        };

        base.OnCreate();
    }
Exemplo n.º 26
0
 protected override void OnCreate()
 {
     base.OnCreate();
     commandBufferSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
     m_Group             = GetEntityQuery(new EntityQueryDesc()
     {
         All = new ComponentType[]
         {
             typeof(EzHasTarget)
         },
         Any = new ComponentType[]
         {
             ComponentType.ReadOnly <EzMoveToTarget>(),
             ComponentType.ReadOnly <EzRotateToTarget>(),
             ComponentType.ReadOnly <HasTargetMove>(),
         },
         Options = EntityQueryOptions.FilterWriteGroup
     });
 }
Exemplo n.º 27
0
 protected override void OnCreate()
 {
     commandBufferSystem = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
     followWPQueryDec    = new EntityQueryDesc {
         All = new ComponentType[] {
             typeof(WayPoint),
             typeof(Action),
             typeof(FollowWayPointsAction),
             typeof(HasReynoldsSeekTargetPos),
             ComponentType.ReadOnly <Translation>(),
         },
         None = new ComponentType[] {
             typeof(StoreWayPoints),
             typeof(ChangeAction),
             typeof(RemoveAction)
         }
     };
     base.OnCreate();
 }
        protected void CalcTTLAndDestryWithECB(EndSimulationEntityCommandBufferSystem escbs, float deltaTime)
        {
            EntityCommandBuffer.Concurrent buf = escbs.CreateCommandBuffer().ToConcurrent();

            // Try the EntityCommandBuffer to destroy entities.
            Entities.ForEach((Entity entity, int entityInQueryIndex, ref PrefabEntityExtraData extraData) =>
            {
                extraData.ttl -= deltaTime;

                if (extraData.ttl < 0)
                {
                    buf.DestroyEntity(entityInQueryIndex, entity);
                }
            }).Schedule();

            // Add dependency

            escbs.AddJobHandleForProducer(this.Dependency);
        }
Exemplo n.º 29
0
        protected override void OnCreate()
        {
            endSimulation = World.DefaultGameObjectInjectionWorld.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();
            var query = new EntityQueryDesc
            {
                Any = new ComponentType[] { typeof(GroupCondition), typeof(Condition) },
                All = new ComponentType[] { typeof(PathFindingData), ComponentType.ReadOnly <Translation>() }
            };

            decisionGroup = GetEntityQuery(query);
            var foodQuery = new EntityQueryDesc
            {
                Any = new ComponentType[] { typeof(FoodHierarchie) },
                All = new ComponentType[] { typeof(Condition), typeof(Walker), ComponentType.ReadOnly <Translation>() }
            };

            foodGroup = GetEntityQuery(foodQuery);
            base.OnCreate();
        }
Exemplo n.º 30
0
        protected override void OnCreate()
        {
            _endSimBarrier = World.GetOrCreateSystem <EndSimulationEntityCommandBufferSystem>();

            _mapQuery = GetEntityQuery(
                ComponentType.ReadOnly <GenerateMap>(),
                ComponentType.ReadOnly <MapData>(),
                ComponentType.ReadWrite <MapTiles>(),
                ComponentType.ReadWrite <MapRooms>()
                );

            _npcQuery = GetEntityQuery(
                ComponentType.ReadOnly <Renderable>(),
                ComponentType.ReadOnly <Position>(),
                ComponentType.Exclude <Player>()
                );

            RequireForUpdate(_mapQuery);
        }