Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial struct RegisterGunfireSystem : ISystem
- {
- EntityQuery query_Enemies;
- ComponentLookup<GunfireEvent> luGunFire;
- public void OnCreate(ref SystemState state)
- {
- query_Enemies = new EntityQueryBuilder(Allocator.Temp)
- .WithAll<EnemyTag>()
- .Build(ref state);
- luGunFire = state.GetComponentLookup<GunfireEvent>(true);
- }
- public void OnUpdate(ref SystemState state)
- {
- luGunFire.Update(ref state);
- new RegisterGunfire
- {
- GunFire = luGunFire,
- }.ScheduleParallel(query_Enemies);
- }
- //[BurstCompile]
- public partial struct RegisterGunfire : IJobEntity
- {
- [ReadOnly] public ComponentLookup<GunfireEvent> GunFire;
- public void Execute(in LocalToWorld transform, ref Stimuli stimuli)
- {
- float3 gunfire = GunFire[???].location;
- if (math.distance(gunfire, transform.Position) < 15) {
- stimuli.HeardGunfire = 1;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement