Skip to content

Instantly share code, notes, and snippets.

View JohnnyTurbo's full-sized avatar
🔥
Taking the Hot Path

Johnny Thompson JohnnyTurbo

🔥
Taking the Hot Path
View GitHub Profile
@JohnnyTurbo
JohnnyTurbo / AddForceSystem.cs
Last active April 13, 2021 20:56
Code for Unity DOTS Physics Add Forces Video - https://youtu.be/3h0nJXPuUm0
using Unity.Entities;
using Unity.Mathematics;
using Unity.Physics;
using Unity.Physics.Extensions;
using UnityEngine;
namespace TMG.PhysicsAddForces
{
[UpdateInGroup(typeof(FixedStepSimulationSystemGroup))]
public class AddForceSystem : SystemBase
using Unity.Entities;
using Unity.Transforms;
namespace TMG.Tags
{
public class MoveRedCubes : SystemBase
{
private EndSimulationEntityCommandBufferSystem _endSimulationEntityCommandBufferSystem;
protected override void OnCreate()
@JohnnyTurbo
JohnnyTurbo / ApplyRadiationSystem.cs
Created May 11, 2021 17:10
Singletons in Unity ECS - Code from tutorial video: https://youtu.be/oSj6w8AeeAg
using Unity.Entities;
namespace TMG.ECS_Singletons
{
public class ApplyRadiationSystem : SystemBase
{
private EndSimulationEntityCommandBufferSystem _endSimulationEntityCommandBufferSystem;
protected override void OnCreate()
{
using Unity.Entities;
namespace TMG.ECS_UI
{
[UpdateInGroup(typeof(LateSimulationSystemGroup))]
public class DestroyCapsuleSystem : SystemBase
{
private EndSimulationEntityCommandBufferSystem _endSimulationEntityCommandBufferSystem;
private Entity _counterEntity;
private DestroyedCapsuleCounterData _counterData;
@JohnnyTurbo
JohnnyTurbo / CentralRandomData.cs
Created May 28, 2021 07:16
Code for ECS Random Tutorial video - https://youtu.be/s-nr9EMmhfo
using Unity.Entities;
using Random = Unity.Mathematics.Random;
namespace TMG.ECS_Random
{
[GenerateAuthoringComponent]
public struct CentralRandomData : IComponentData
{
public Random Value;
}
@JohnnyTurbo
JohnnyTurbo / EntitySpawnData.cs
Created June 3, 2021 18:42
ECS Entity Manager Project Files from Tutorial Video - https://youtu.be/Pa6Uf2jLUQg
using Unity.Entities;
using Unity.Mathematics;
namespace TMG.ECS_EntityManager
{
[GenerateAuthoringComponent]
public struct EntitySpawnData : IComponentData
{
public Entity EntityPrefab;
public int2 SpawnGrid;
@JohnnyTurbo
JohnnyTurbo / CapsuleTag.cs
Created June 11, 2021 07:26
Entity Command Buffer Code from tutorial - https://youtu.be/hALEF5f7Mos
using Unity.Entities;
namespace TMG.ECS_CommandBuffer
{
public struct CapsuleTag : IComponentData {}
}
@JohnnyTurbo
JohnnyTurbo / HorizontalPosition.cs
Last active September 1, 2022 12:10
Code to create a connect four game using Unity ECS to demonstrate use of shared data components for tutorial video - https://youtu.be/QFJEyZ3LQFI
using Unity.Entities;
namespace TMG.ConnectFour
{
public struct HorizontalPosition : ISharedComponentData
{
public int Value;
}
}
@JohnnyTurbo
JohnnyTurbo / BattleControlData.cs
Created July 9, 2021 06:12
Code used in ECS Change Filters tutorial video - https://youtu.be/M3o9yOSTdrQ
using Unity.Entities;
namespace TMG.ChangeFilter
{
[GenerateAuthoringComponent]
public struct BattleControlData : IComponentData
{
public Entity Enemy1;
public Entity Enemy2;
public Entity Enemy3;
using Unity.Entities;
namespace TMG.DynamicBuffers
{
[InternalBufferCapacity(8)]
[GenerateAuthoringComponent]
public struct FishLengthBufferElement : IBufferElementData
{
public int Value;