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; }
private void PurchaseTower() { Spell equippedAbility = playerState.GetEquippedSlotAbility(); if (equippedAbility == null) { return; } if (towerManager.CreateTower(equippedAbility, transform)) { IsOccupied = true; } }