public void Interact(InteractController interactController)
    {
        MoneyController moneyController = interactController.gameObject.GetComponent <MoneyController>();

        if (keyRequirement)
        {
            if (moneyController.HasKey())
            {
                moneyController.SetKey(false);
                open = true;
                GetComponent <AudioSource>().Play();
                if (newEnemySpawnGroup != null)
                {
                    GameObject.Find("WaveManager").GetComponent <WaveManager>().AddSpawns(newEnemySpawnGroup);
                }
            }
        }
        else if (moneyCost <= moneyController.GetMoney())
        {
            moneyController.DeductMoney(moneyCost);
            open = true;
            GetComponent <AudioSource>().Play();
            if (newEnemySpawnGroup != null)
            {
                GameObject.Find("WaveManager").GetComponent <WaveManager>().AddSpawns(newEnemySpawnGroup);
            }
        }
    }
Beispiel #2
0
 public bool Buy(MoneyController controller)
 {
     if (cost <= controller.GetMoney())
     {
         controller.DeductMoney(cost);
         GameObject.Find("GameManager").GetComponent <AudioSource>().PlayOneShot(buySound);
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #3
0
 public bool Buy(MoneyController controller)
 {
     if (cost <= controller.GetMoney())
     {
         controller.DeductMoney(cost);
         print(controller.GetMoney());
         return(true);
     }
     else
     {
         return(false);
     }
 }