Example #1
0
 protected override void OnCreate()
 {
     base.OnCreate();
     m_EntityCommandBufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
     m_ArmDataQuery    = GetEntityQuery(typeof(ThrowingArmsSharedDataComponent));
     m_tinCanDataQuery = GetEntityQuery(typeof(TinCanSharedDataComponent));
 }
Example #2
0
 /// <summary>
 /// Need to call base.OnCreate() at start of the function.
 /// </summary>
 protected override void OnCreate()
 {
     beginInitializationBuffer = World.GetExistingSystem <BeginInitializationEntityCommandBufferSystem>();
     beginSimulationBuffer     = World.GetExistingSystem <BeginSimulationEntityCommandBufferSystem>();
     endSimulationBuffer       = World.GetExistingSystem <EndSimulationEntityCommandBufferSystem>();
     beginPresentationBuffer   = World.GetExistingSystem <BeginPresentationEntityCommandBufferSystem>();
 }
Example #3
0
 protected override void OnCreateManager()
 {
     m_BeginEntityCommandBufferSystem = World.GetOrCreateManager <BeginInitializationEntityCommandBufferSystem>();
     m_EndEntityCommandBufferSystem   = World.GetOrCreateManager <EndInitializationEntityCommandBufferSystem>();
     m_systemsToUpdate.Add(m_BeginEntityCommandBufferSystem);
     m_systemsToUpdate.Add(m_EndEntityCommandBufferSystem);
 }
Example #4
0
    protected override void OnCreate()
    {
        RequireSingletonForUpdate <GridConfig>();

        // Cache the BeginInitializationEntityCommandBufferSystem in a field, so we don't have to create it every frame
        m_EntityCommandBufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
    }
Example #5
0
 public void SetUp()
 {
     world        = new World($"Test_DisconnectSystem_{testCount++}");
     bufferSystem = world.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
     world.GetOrCreateSystem <EventComponentSystem>();
     destroyWorldSystem = world.GetOrCreateSystem <MyDestroyWorldSystem>();
 }
Example #6
0
 protected override void OnCreate()
 {
     _clickedQuery   = GetEntityQuery(ComponentType.ReadOnly <ClickedComponent>());
     _positionsQuery = GetEntityQuery(ComponentType.ReadOnly <PositionComponent>());
     _commandBuffer  = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
     RequireForUpdate(_clickedQuery);
 }
    protected override void OnCreate()
    {
        commandBufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
        effectSystem        = World.GetOrCreateSystem <EffectRequestSystem>();

        // get entities that define players
        players = GetEntityQuery(new EntityQueryDesc {
            All = new ComponentType[] {
                ComponentType.ReadOnly <Translation>(),
                ComponentType.ReadOnly <Rotation>(),
                ComponentType.ReadOnly <PlayerShoot>()
            }
        });

        waterBullets = GetEntityQuery(new EntityQueryDesc {
            All = new ComponentType[] {
                typeof(Translation),
                typeof(Scale),
                ComponentType.ReadOnly <WaterShootIndex>(),
                typeof(PhysicsCollider),
                typeof(BulletDamage)
            }
        });

        ScheduleWeapon none = (PlayerShootJobData jobData, JobHandle deps) => deps;

        weaponSchedulers.Add(PlayerStats.WeaponTypes.Basic, ScheduleBasicWeapon);
        weaponSchedulers.Add(PlayerStats.WeaponTypes.Water, ScheduleWaterWeapon);
        weaponSchedulers.Add(PlayerStats.WeaponTypes.Basic | PlayerStats.WeaponTypes.Water,
                             ScheduleBoostBasicWaterWeapon);
    }
Example #8
0
    protected override void OnCreate()
    {
        commandBuffer = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
        var seed = new System.Random();

        Random = new Unity.Mathematics.Random((uint)seed.Next());
    }
Example #9
0
    protected override void OnCreate()
    {
        m_beginBarrier = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
        m_endBarrier   = World.GetOrCreateSystem <EndInitializationEntityCommandBufferSystem>();

        foreach (var system in World.Active.Systems)
        {
            int depth = 0;
            var type  = system.GetType();
            if (SystemUtils.IsInSystem(system.GetType(), typeof(PresentationSystemGroup), ref depth))
            {
                if (depth > 1)
                {
                    var groups   = type.GetCustomAttributes(typeof(UpdateInGroupAttribute), true);
                    var group    = groups[0] as UpdateInGroupAttribute;
                    var groupSys = World.GetOrCreateSystem(group.GroupType) as ComponentSystemGroup;
                    groupSys.AddSystemToUpdateList(World.GetOrCreateSystem(type));
                    AddSystemToUpdateList(groupSys);
                }
                else
                {
                    AddSystemToUpdateList(World.GetOrCreateSystem(system.GetType()));
                }
            }
        }

        SortSystemUpdateList();
    }
Example #10
0
 protected override void OnCreate()
 {
     // Cache the BeginInitializationEntityCommandBufferSystem in a field, so we don't have to create it every frame
     m_EntityCommandBufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
     m_GridQuery = GetEntityQuery(ComponentType.ReadOnly <CartesianGridOnCube>());
     RequireForUpdate(m_GridQuery);
 }
Example #11
0
 protected override void OnCreate()
 {
     alphaQuery = GetEntityQuery(typeof(Pawn), typeof(Alpha));
     betaQuery  = GetEntityQuery(typeof(Pawn), typeof(Beta));
     entityCommandBufferSystem =
         World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
 }
Example #12
0
    protected override void OnCreate()
    {
        commandBufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();

        // shooters will have all entities with Timealive, Translation,
        //    Rotation, and AutoShoot
        // Translation, Rotation, and AutoShoot will have read only access
        shooters = GetEntityQuery(new EntityQueryDesc {
            All = new ComponentType[] {
                typeof(TimePassed),
                ComponentType.ReadOnly <Translation>(),
                ComponentType.ReadOnly <Rotation>(),
                ComponentType.ReadOnly <AutoShootBuffer>()
            }
        });
        players = GetEntityQuery(new EntityQueryDesc {
            All = new ComponentType[] {
                typeof(Player),
                ComponentType.ReadOnly <Translation>()
            }
        });

        // only update if there's a shooter
        RequireForUpdate(shooters);
    }
    void Start()
    {
        _entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
        _inputEntity   = _entityManager.CreateEntity(typeof(InputComponent));
        _query         = _entityManager.CreateEntityQuery(typeof(InputComponent));

        _beginInitializationEntityCommandBufferSystem = World.DefaultGameObjectInjectionWorld.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
    }
Example #14
0
 protected override void OnCreate()
 {
     //Нужно только лишь для commandBuffer в OnUpdate
     bufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
     //Эти штуки нужны для Schedule в OnUpdate
     buildPhysicsWorld = World.GetOrCreateSystem <BuildPhysicsWorld>();
     stepPhysicsWorld  = World.GetOrCreateSystem <StepPhysicsWorld>();
 }
Example #15
0
 protected override void OnCreate()
 {
     beginInitEcbSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
     // We explicitly create this query to force the system to only start running if there are player entities.
     // Otherwise, the system will always update once before the implicit Query from the IJobForEach is generated,
     // which causes the Shell prefab lookup to fail in Scenes where the prefab doesn't exist.
     this.GetEntityQueryForIJobForEach(typeof(SpawnShellsJob));
 }
Example #16
0
        protected override void OnCreate()
        {
            base.OnCreate();

            _buildPhysicsWorldSystem = World.GetOrCreateSystem <BuildPhysicsWorld>();
            _stepPhysicsWorldSystem  = World.GetOrCreateSystem <StepPhysicsWorld>();
            _commandBufferSystem     = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
        }
        protected override void OnCreate()
        {
            // Enable this system only for HelloCube_08 scene.
            Enabled = SceneManager.GetActiveScene().name.StartsWith("HelloCube_08");

            // Cache the BeginInitializationEntityCommandBufferSystem in a field, so we don't have to create it every frame
            m_EntityCommandBufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
        }
        protected override void OnCreate()
        {
            base.OnCreate();
            forDispose = new List <NativeHashMap <char, Entity> >(4);
            ecbs       = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();

            RequireForUpdate(noLookupFontAssetQuery);
        }
    protected override void OnCreate()
    {
        bufferSystem     = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
        spawningTeamBees = GameObject.FindObjectOfType <MouseInputManager>().spawningTeamBees;

        team1 = GameObjectConversionUtility.ConvertGameObjectHierarchy(spawningTeamBees[0], World.Active);
        team2 = GameObjectConversionUtility.ConvertGameObjectHierarchy(spawningTeamBees[1], World.Active);
    }
Example #20
0
    protected override void OnCreate()
    {
        // Set the delay of the explosion
        explosion.delay     = 3f;
        explosion.countdown = explosion.delay;

        // Initialize the EntityCommandBuffer
        BufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
    }
Example #21
0
 public void SetUp()
 {
     world  = new World($"Test_ListenSystem_{testCount++}");
     system = world.CreateSystem <MyListenSystem>();
     proxy  = new MyNetworkStreamProxy();
     system.NetworkStreamProxy = proxy;
     bufferSystem = world.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
     world.GetOrCreateSystem <EventComponentSystem>();
 }
Example #22
0
        static public void PlayAgain()
        {
            Reset();
            BeginInitializationEntityCommandBufferSystem bufferSystem = World.DefaultGameObjectInjectionWorld.GetExistingSystem <BeginInitializationEntityCommandBufferSystem>();
            EntityCommandBuffer buffer = bufferSystem.CreateCommandBuffer();

            buffer.CreateEntity(RestartArchetype);
            Instance.StartCoroutine(Instance.RestartGame());
        }
        protected override void OnCreate()
        {
            m_weaponCleanupQuery = GetEntityQuery(
                typeof(Weapon),
                typeof(WeaponFired)
                );

            m_weaponCleanupEntityCommandBuffer = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
        }
        protected override void OnCreate()
        {
            _entityCommandBufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
            _buildPhysicsWorldSystem   = World.GetOrCreateSystem <BuildPhysicsWorld>();

            _query = GetEntityQuery(new EntityQueryDesc()
            {
                All = new ComponentType[] {
                    ComponentType.ReadOnly <Translation>(),
                    ComponentType.ReadOnly <Rotation>(),
                    typeof(PhysicsVelocity),
                    ComponentType.ReadOnly <PhysicsMass>(),
                    typeof(FighterComponent),
                },
            });
            _targetableQuery = GetEntityQuery(new EntityQueryDesc()
            {
                All = new ComponentType[] {
                    ComponentType.ReadOnly <FighterTargetable>(),
                },
            });

#if SEARCHING
            cast_collider_ = SphereCollider.Create(new float3(0, 0, 0) /* center */,
                                                   1f /* radius */,
                                                   new CollisionFilter {
                BelongsTo    = ~0u,
                CollidesWith = ~0u,
            },
                                                   null /* material */);

            // create approximate hexagonal directions.
            //      2
            //   6     4
            //      0
            //   5     3
            //      1
            local_search_rotations_    = new NativeArray <quaternion>(FighterConfig.SEARCH_NUM, Allocator.Persistent);
            local_search_rotations_[0] = quaternion.Euler(0, 0, 0);
            local_search_rotations_[1] = quaternion.Euler(math.radians(10f), 0, 0);
            local_search_rotations_[2] = quaternion.Euler(math.radians(-10f), 0, 0);
            local_search_rotations_[3] = quaternion.Euler(math.radians(5f), math.radians(5f * 1.7320508f), 0);
            local_search_rotations_[4] = quaternion.Euler(math.radians(-5f), math.radians(5f * 1.7320508f), 0);
            local_search_rotations_[5] = quaternion.Euler(math.radians(5f), math.radians(-5f * 1.7320508f), 0);
            local_search_rotations_[6] = quaternion.Euler(math.radians(-5f), math.radians(-5f * 1.7320508f), 0);
#endif

            _lastPrimaryFighterPos = new NativeArray <float3>(1, Allocator.Persistent);
            _lastPrimaryTargetPos  = new NativeArray <float3>(1, Allocator.Persistent);
        #if RECORDING
            controller_buffer_ = new NativeList <ControllerUnit>(ControllerBuffer.MAX_FRAMES, Allocator.Persistent);
            controller_device_ = new ControllerDevice(controller_buffer_);
            controller_device_.start(Time.GetCurrent());
        #else
            _controllerBuffer = ControllerBuffer.Load <ControllerUnit>("controller.bin");
        #endif
        }
    protected override void OnCreate()
    {
        commandBufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();

        enemies = GetEntityQuery(new EntityQueryDesc {
            All = new ComponentType[] {
                ComponentType.ReadOnly <Enemy>()
            }
        });
    }
Example #26
0
 protected override void OnCreate()
 {
     m_EntityCommandBuffer = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
     m_Group = GetEntityQuery(ComponentType.ReadOnly <GameplayEffectDurationComponent>());
     // Create test entities
     // var archetype = EntityManager.CreateArchetype(
     //     typeof(GameplayEffectDurationComponent),
     //     typeof(GameplayEffectAttributeEntityComponent)
     // );
 }
Example #27
0
    protected override void OnCreate()
    {
        m_EntityCommandBufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
        var query = new EntityQueryDesc
        {
            All = new ComponentType[] { ComponentType.ReadOnly <Data>(), ComponentType.ReadOnly <NewDataTag>() }
        };

        m_Spawner = GetEntityQuery(query);
    }
Example #28
0
 protected override void OnCreate()
 {
     base.OnCreate();
     m_entityCommandBufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
     m_transformQuery            = GetEntityQuery(
         new EntityQueryDesc {
         All     = new ComponentType[] { typeof(LocalToWorld) },
         Options = EntityQueryOptions.IncludeDisabled
     });
 }
Example #29
0
 protected override void OnCreate()
 {
     commandBufferSystem    = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
     nodeQuery              = GetEntityQuery(typeof(TreeId), typeof(AINodeStatus));
     moveForwardQuery       = GetEntityQuery(typeof(AINodeStatus), typeof(AINodeMoveForward), typeof(Translation), typeof(Rotation));
     turnQuery              = GetEntityQuery(typeof(AINodeStatus), typeof(AINodeTurn), typeof(Rotation));
     chaseQuery             = GetEntityQuery(typeof(AINodeStatus), typeof(AINodeChase), typeof(Rotation), typeof(Translation));
     destroyGameObjectQuery = GetEntityQuery(typeof(AIRoot), typeof(AINodeStatus), typeof(AINodeDestroyGameObject));
     targetPositionQuery    = GetEntityQuery(typeof(Address), typeof(Translation));
 }
Example #30
0
 protected override void OnCreate()
 {
     base.OnCreate();
     m_entityCommandBufferSystem = World.GetOrCreateSystem <BeginInitializationEntityCommandBufferSystem>();
     m_allActivatableQuery       = GetEntityQuery(
         new EntityQueryDesc {
         All     = new ComponentType[] { ComponentType.ReadOnly <Active>() },
         Options = EntityQueryOptions.IncludeDisabled
     });
 }