private Entity GetMaterial(ColorsType colorsType) { Entity mainEntity = GetSingletonEntity <GameDataComponent>(); var buffer = GetBuffer <ColorsBuffer>(mainEntity); return(buffer[(int)colorsType].Entity); }
public GLine() { InitializeComponent(); this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true); colors = ColorsType.TowColors; }
private void SetGameDataColor(ColorsType colorsType) { Entities.WithAll <GameDataComponent>() .WithBurst() .ForEach((ref GameDataComponent gameData) => { gameData.Color = colorsType; }).Schedule(); }
private void SetDynamicBoxColor(Entity material, ColorsType colorsType) { Entities.WithAll <DynamicColorBoxTagComponent>(). WithBurst(). ForEach((ref ColorBoxComponent colorBoxComponent, ref MeshRenderer meshRenderer) => { colorBoxComponent.ColorsType = colorsType; meshRenderer.material = material; }).Schedule(); }
private void OnTriggerTeleport(TriggerEvent triggerEvent) { ColorsType colorsType = ColorBoxComponents[triggerEvent.EntityB].ColorsType; CommandBuffer.AddComponent(EntityCamera, new ChangePlayerColorComponent { ColorsType = colorsType }); for (var i = 0; i < ChildBufferFromEntity[triggerEvent.EntityB].Length; i++) { CommandBuffer.DestroyEntity(ChildBufferFromEntity[triggerEvent.EntityB][i].Value); } CommandBuffer.DestroyEntity(triggerEvent.EntityB); }
protected override void OnUpdate() { ColorsType colorsType = GetSingleton <ChangePlayerColorComponent>().ColorsType; Entity entityMaterial = GetMaterial(colorsType); SetPlayerColor(entityMaterial); SetBoxColor(entityMaterial, colorsType); SetDynamicBoxColor(entityMaterial, colorsType); SetGameDataColor(colorsType); Entity cSingletonEntity = GetSingletonEntity <ChangePlayerColorComponent>(); EntityManager.RemoveComponent <ChangePlayerColorComponent>(cSingletonEntity); }