using Unity.Entities; namespace TinyKitchen { /// /// Display Arrow according to the game state /// public class DisplayArrow : SystemBase { protected override void OnUpdate() { var game = GetSingleton(); if (game.gameState == GameState.Flying) { // Hide arrows Entities.ForEach((ref Entity entity, in ArrowComponent arrow) => { EntityManager.AddComponent(entity); }).WithoutBurst().WithStructuralChanges().Run(); } if (game.gameState == GameState.Idle) { // Show arrows Entities.ForEach((ref Entity entity, in ArrowComponent arrow, in Disabled disabled) => { EntityManager.RemoveComponent(entity); }).WithoutBurst().WithStructuralChanges().Run(); } } } }