示例#1
0
 private void SilverButton()
 {
     if (money.coins >= 100)
     {
         buySound.Play();
         money.RemoveCoin(100);
         slider.value = 1;
         silverButton.interactable = false;
         goldButton.interactable   = true;
         var player   = GameObject.FindGameObjectWithTag("Player");
         var animator = player.GetComponent <Animator>();
         //animator.runtimeAnimatorController = Resources.Load<RuntimeAnimatorController>("Assets/Resources/PlayerSilver");
         animator.runtimeAnimatorController = silver;
         FindObjectOfType <HealthController>().IncreaseMaxLife(2);
         FindObjectOfType <HealthController>().AddLive(2);
     }
 }
示例#2
0
    public void Buy(string item)
    {
        switch (item)
        {
        case "healthPotion":
            if (money.coins >= healthPotionPrice)
            {
                money.RemoveCoin(healthPotionPrice);
                health.AddPotion();
                moneyHandle.Play();
            }
            break;

        case "extraLife":
            if (money.coins >= extraLifePrice)
            {
                money.RemoveCoin(extraLifePrice);
                health.IncreaseMaxLife();
                moneyHandle.Play();
            }
            break;
        }
    }