private void Update() { AtmosGas gas = World.Active.EntityManager.GetComponentData <AtmosGas>(entity); text.text = $"{gas.Type}\n{gas.Pressure}"; image.fillAmount = gas.Pressure / maxFill; }
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem) { for (var i = 0; i < gasses.Count; i++) { AtmosGas atmosGas = gasses[i]; Entity ent = dstManager.CreateEntity(); dstManager.AddComponentData(ent, new AtmosGas { Entity = ent, Pressure = atmosGas.Pressure, Type = atmosGas.Type, Color = atmosGas.Color }); dstManager.AddBuffer <SurroundingAtmosGas>(ent); dstManager.AddComponentData(ent, new AtmosFindSurroundings_Tag()); dstManager.AddComponentData(ent, new Translation() { Value = transform.position }); GasVisual visual = Instantiate(visualPrefab, transform); visual.Init(ent); } }