void Start() { var prefabEntity = entityManager.CreateEntityQuery(typeof(NavAgentPrefab)).GetSingleton <NavAgentPrefab>().Value; SpawnSystem.Enqueue(new Spawn() .WithPrefab(prefabEntity) .WithComponentList( new NavAgent { JumpDegrees = 45, JumpGravity = 100, JumpSpeedMultiplierX = 1.5f, JumpSpeedMultiplierY = 2, TranslationSpeed = 20, TypeID = NavUtil.GetAgentType(NavConstants.HUMANOID), Offset = new float3(0, 1, 0) }, new NavNeedsSurface { }, new Parent { }, new LocalToParent { }, new Translation { Value = new float3(0, 1, 0) } ), 50 ); }
void Start() { var prefabEntity = entityManager.CreateEntityQuery(typeof(PersonPrefab)).GetSingleton <PersonPrefab>().Value; SpawnSystem.Enqueue(new Spawn() .WithPrefab(prefabEntity) .WithComponentList( new Translation { Value = new float3(0, 1, 0) } ) ); SpawnSystem.Enqueue(new Spawn() .WithPrefab(prefabEntity) .WithComponentList( new Translation { Value = new float3(5, 1, 0) } ) ); SpawnSystem.Enqueue(new Spawn() .WithPrefab(prefabEntity) .WithComponentList( new Translation { Value = new float3(-5, 1, 0) } ) ); }
void Start() { var prefabEntity = entityManager.CreateEntityQuery(typeof(DinosaurPrefab)).GetSingleton <DinosaurPrefab>().Value; SpawnSystem.Enqueue(new Spawn() .WithPrefab(prefabEntity) .WithComponentList( new NavAgent { JumpDegrees = 45, JumpGravity = 100, JumpSpeedMultiplierX = 2, JumpSpeedMultiplierY = 4, TranslationSpeed = 40, TypeID = NavUtil.GetAgentType(NavConstants.HUMANOID), Offset = new float3(0, 1, 0) }, new Parent { }, new LocalToParent { }, new LocalToWorld { Value = float4x4.TRS( new float3(0, 1, 0), quaternion.identity, 1 ) }, new NavNeedsSurface { } ) ); }
void Enqueue() { SpawnSystem.Enqueue(new Spawn() .WithPrefab(currentPrefab) .WithComponentList( new NavAgent { JumpDegrees = 45, JumpGravity = 200, TranslationSpeed = 20, TypeID = NavUtil.GetAgentType(NavConstants.HUMANOID), Offset = new float3(0, 1, 0) }, new Parent { }, new LocalToParent { }, new LocalToWorld { Value = float4x4.TRS( new float3(0, 1, 0), quaternion.identity, 1 ) }, new NavNeedsSurface { } ), enqueueCount ); }
private async Task SpawnRandomAsync(int count, int delayMs, Entity[] entityPrefas) { for (int i = 0; i < count; i++) { // Enqueue spawning (SpawnSystem and Spawn are from Reese.Spawning): SpawnSystem.Enqueue(MakeRandomSpawn(entityPrefas)); await Task.Delay(delayMs); } }
void Enqueue() { if (!IsForAgents) { var random = new Unity.Mathematics.Random((uint)new System.Random().Next()); for (int i = 0; i < enqueueCount; ++i) { SpawnSystem.Enqueue(new Spawn() .WithPrefab(prefabEntity) .WithComponentList( new Translation { Value = new float3( random.NextInt(-25, 25), 2, random.NextInt(-25, 25) ) } ) ); } return; } SpawnSystem.Enqueue(new Spawn() .WithPrefab(prefabEntity) .WithComponentList( new NavAgent { JumpDegrees = 45, JumpGravity = 200, TranslationSpeed = 20, TypeID = NavUtil.GetAgentType(NavConstants.HUMANOID), Offset = new float3(0, 1, 0) }, new NavNeedsSurface { }, new Parent { }, new LocalToParent { }, new Translation { Value = new float3(0, 1, 0) } ), enqueueCount ); }
void Enqueue() { var random = new Unity.Mathematics.Random((uint)new System.Random().Next()); for (int i = 0; i < enqueueCount; ++i) { SpawnSystem.Enqueue(new Spawn() .WithPrefab(prefabEntity) .WithComponentList( new Translation { Value = new float3( random.NextInt(-25, 25), 2, random.NextInt(-25, 25) ) } ) ); } }