Esempio n. 1
0
    protected override void OnUpdate()
    {
        Entities.ForEach((ref ShopComponent shopComponent) =>
        {
            if (shopComponent.ShowingShopButton)
            {
                Entities.ForEach((ref PlayerComponent playerComponent) =>
                {
                    if (!Input.GetButton("A Button"))
                    {
                        return;
                    }

                    GameUI.StorageBar.Clean();

                    var needFuelToHaveMax = 100 - GameUI.FuelBar.CurrentValue;
                    var moneyAfterRefuel  = playerComponent.TempMoney - needFuelToHaveMax;

                    GameUI.AddMoney(moneyAfterRefuel > 0 ? moneyAfterRefuel : 0);
                    GameUI.FuelBar.IncreaseValue(moneyAfterRefuel > 0 ? needFuelToHaveMax : playerComponent.TempMoney);

                    playerComponent.TempMoney = 0f;
                });
            }
        });
    }