void Start() { rigidBody = GetComponent <Rigidbody>(); audioSource = GetComponent <AudioSource>(); rocketAnimator = GetComponent <Animator>(); currentGems = PlayerPrefsController.GetMaxGems(); state = State.Alive; }
void Update() { fuelLevel = PlayerPrefsController.GetFuelLevel(); armorLevel = PlayerPrefsController.GetArmorLevel(); gemsDisplay.text = PlayerPrefsController.GetMaxGems().ToString(); SetFuelCostValue(); SetArmorCostValue(); }
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); } }
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); } }