Ejemplo n.º 1
0
        private void OnGuiInput(InputEvent @event)
        {
            if (!_isActive)
            {
                return;
            }
            if (@event.IsActionPressed("picked_up"))
            {
                if (@event is InputEventMouseButton mouseButton && TowerType != null)
                {
                    if (GameInfo.GameCurrency.CanAfford(TowerType.Cost))
                    {
                        _towerManager.CreateTower(TowerType, mouseButton.GlobalPosition);
                    }
                    else
                    {
                        _background.Color      = GameInfo.InvalidColour;
                        _button.TexturePressed = _normalTexture;
                    }
                }
            }

            if ([email protected]("picked_up"))
            {
                return;
            }
            _background.Color      = _backgroundColour;
            _button.TexturePressed = _buyingTexture;
        }
Ejemplo n.º 2
0
    private void PurchaseTower()
    {
        Spell equippedAbility = playerState.GetEquippedSlotAbility();

        if (equippedAbility == null)
        {
            return;
        }

        if (towerManager.CreateTower(equippedAbility, transform))
        {
            IsOccupied = true;
        }
    }