コード例 #1
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);
        }
    }
コード例 #2
0
ファイル: RocketShip.cs プロジェクト: HishamJaffar98/NeoShip
 void Awake()
 {
     maxFuel   = PlayerPrefsController.GetMaxFuel();
     fuelLevel = PlayerPrefsController.GetMaxFuel();
     lives     = PlayerPrefsController.GetMaxLives();
 }