// Makes a RecruitUI for the unit and places in the right position
    public void CreateRecruit(int index, int totalCount, Unit unit)
    {
        // Find the position
        Vector3 position = spawnParent.GetChild(index).position;

        //Instantiate RecruitUI under the manager
        Recruited recruit = Instantiate(RecruitUIPrefab, position, Quaternion.identity, transform).GetComponent <Recruited>();

        recruit.Setup(unit);
    }
示例#2
0
    public void AttemptBuyRecruit(Recruited recruited, Tile tile)
    {
        if (currentPlayer.moveInProcess)
        {
            return;
        }

        int cost = treatsCostByRarity[recruited.recruit.rarity];

        if (currentPlayer.GetTreats() >= cost)
        {
            currentPlayer.UpdateTreats(currentPlayer.GetTreats() - cost);
            PlaceUnitOnTile(recruited.recruit, tile);
            Destroy(recruited.gameObject);
        }
    }