private void DoDPadAction(int towerIndex)
    {
        TowerScriptableObject tower = ui.ControllerWheel.GetTower(towerIndex);

        if (_currentState == PlayerStates.FREE && inventoryManager.ResourceAmount >= tower.Cost)
        {
            inventoryManager.ResourceAmount -= tower.Cost;
            tower.InstantiateConstructionTower(this);
            SetState(PlayerStates.BUILDING);
        }
    }
    public void Select()
    {
        //Turns on the UI
        ui.gameObject.SetActive(true);
        UpdatePos();
        //Turns off the UI if button no longer held
        if (!playerStateController.Select)
        {
            TowerScriptableObject selectedSegment = GetSelectedSegment();
            if (selectedSegment &&
                inventory.ResourceAmount - selectedSegment.Cost >= 0)
            {
                inventory.ResourceAmount -= selectedSegment.Cost;
                selectedSegment.InstantiateConstructionTower(playerStateController);
                playerStateController.SetState(PlayerStates.BUILDING);
            }
            else
            {
                playerStateController.SetState(PlayerStates.FREE);
            }

            ui.gameObject.SetActive(false);
        }
    }
Beispiel #3
0
 public void SetBuildTower(TowerScriptableObject tower)
 {
     _bc.SetPreview(tower);
 }
 public void SetBuildTower(TowerScriptableObject input)
 {
     UserInterfaceController.Instance.BuildPanel.SetBuildTower(input);
 }