Exemple #1
0
    private void Start()
    {
        tiles = new Dictionary <Vector2, Tile>();

        resetGame += ResetBoard;
        resetGame();

        display.gameObject.SetActive(false);
        attackButton.SetActive(false);

        shop.SetupShop(teams);
        shop.HideShop();
        shop.unitBought += UpdateUI;

        UpdateUI();
    }
Exemple #2
0
    /// <summary>
    /// Attempts to buy the unit
    /// </summary>
    public void BuyUnit()
    {
        if (team.Currency >= unitPrefab.GetComponent <Unit>().Cost)
        {
            Unit newUnit = Instantiate(unitPrefab, team.transform).GetComponent <Unit>();
            newUnit.Position         = Board.SelectedPosition;
            newUnit.currentMoveRange = 0;
            newUnit.Team             = team.teamType;
            Board.Tiles[Board.SelectedPosition].OccupyingUnit = newUnit;
            team.Currency -= newUnit.Cost;
            team.AddUnit(newUnit);

            if (shop.unitBought != null)
            {
                shop.unitBought();
            }
        }

        Board.DeselectTiles();
        Board.SelectionState = SelectionState.Unit;
        shop.HideShop();
    }