Esempio n. 1
0
 void Start()
 {
     rigidBody      = GetComponent <Rigidbody>();
     audioSource    = GetComponent <AudioSource>();
     rocketAnimator = GetComponent <Animator>();
     currentGems    = PlayerPrefsController.GetMaxGems();
     state          = State.Alive;
 }
Esempio n. 2
0
 void Update()
 {
     fuelLevel        = PlayerPrefsController.GetFuelLevel();
     armorLevel       = PlayerPrefsController.GetArmorLevel();
     gemsDisplay.text = PlayerPrefsController.GetMaxGems().ToString();
     SetFuelCostValue();
     SetArmorCostValue();
 }
Esempio n. 3
0
    public void UpgradeFuel()
    {
        int currentGems = PlayerPrefsController.GetMaxGems();

        if (currentGems >= fuelCost && fuelLevel < maxFuelLevel)
        {
            fuelLevel++;
            PlayerPrefsController.SetMaxFuel(PlayerPrefsController.GetMaxFuel() + 500);
            PlayerPrefsController.SetMaxGems(currentGems - fuelCost);
            PlayerPrefsController.SetFuelLevel(fuelLevel);
            AudioSource.PlayClipAtPoint(audioToPlay[0], Camera.main.transform.position);
            GameObject fireworkVFX = Instantiate <GameObject>(fireworks, spawnLocation.transform.position, Quaternion.identity);
            Destroy(fireworkVFX, fireworkDelayToDestroy);
        }
        else
        {
            AudioSource.PlayClipAtPoint(audioToPlay[1], Camera.main.transform.position);
        }
    }
Esempio n. 4
0
    public void UpgradeArmor()
    {
        int currentGems = PlayerPrefsController.GetMaxGems();

        if (currentGems >= armorCost && armorLevel < maxArmorLevel)
        {
            armorLevel++;
            PlayerPrefsController.SetMaxLives(armorLevel + 1);
            PlayerPrefsController.SetMaxGems(currentGems - armorCost);
            PlayerPrefsController.SetArmorLevel(armorLevel);
            AudioSource.PlayClipAtPoint(audioToPlay[0], Camera.main.transform.position);
            GameObject fireworkVFX = Instantiate <GameObject>(fireworks, spawnLocation.transform.position, Quaternion.identity);
            Destroy(fireworkVFX, fireworkDelayToDestroy);
        }
        else
        {
            AudioSource.PlayClipAtPoint(audioToPlay[1], Camera.main.transform.position);
        }
    }