コード例 #1
0
    public bool CreateTower(Tower tower, Vector3 position)
    {
        Goldmine goldmine = FindObjectOfType <Goldmine>();

        if (goldmine == null)
        {
            return(false);
        }
        if (goldmine.CurrentBalance >= cost)
        {
            Instantiate(tower.gameObject, position, Quaternion.identity);
            goldmine.Withdraw(cost);
            return(true);
        }
        return(false);
    }
コード例 #2
0
 void Start()
 {
     goldmine = FindObjectOfType <Goldmine>();
 }