Exemple #1
0
 private void InitShieldFunc()
 {
     shieldTime = GamerPrefs.GetShieldDuration();
     MovingThingsFactory.CanMakeShields = true;
     shieldCover.SetActive(false);
     isShielded = false;
 }
Exemple #2
0
    private void UpdateBankBalance()
    {
        int bankBalance = GamerPrefs.GetOkane();

        bankBalance += okane;
        GamerPrefs.SetOkane(bankBalance);
    }
    public void HandleSound()
    {
        if (optionsPanelVisible)
        {
            optionsPanelVisible = false;
            optionsPanel.SetActive(false);
        }
        int music = GamerPrefs.GetMusicOn();

        if (music == 1)
        {
            music = 0;
            GamerPrefs.SetMusicOn(0);
        }
        else
        {
            music = 1;
            GamerPrefs.SetMusicOn(1);
        }
        Text soundText = soundButton.GetComponent <Text>();

        soundText.text = (music == 1) ? "Sound On" : "Sound Off";
        willPlay       = (music == 1) ? true : false;
        HandleMainMenuBgMusic();
    }
    private void InitMusic()
    {
        audioSource = GetComponent <AudioSource>();
        var music = GamerPrefs.GetMusicOn(); // 悪い

        willPlay = (music == 1) ? true : false;
    }
    private void UpdateBankBalance()
    {
        var bankBalance = GamerPrefs.GetMoney();

        bankBalance += okane;
        GamerPrefs.SetMoney(bankBalance);
    }
Exemple #6
0
    private void HandleHighScoreText()
    {
        var score = GamerPrefs.GetHighScore();

        highScore      = GameObject.Find("High Score").GetComponent <Text>();
        highScore.text = "High Score: " + score;
    }
Exemple #7
0
 private void InitShieldFunc()
 {
     shieldTime = GamerPrefs.GetShieldDuration();
     MovingTingsFactory.CAN_MAKE_SHIELDS = true;
     shieldCover.SetActive(false);
     isShielded = false;
 }
Exemple #8
0
    public void AddMoney()
    {
        int money = GamerPrefs.GetOkane();

        money += 1;
        GamerPrefs.SetOkane(money);
        this.money.text = GamerPrefs.GetOkane().ToString();
    }
    private void HandleMusicButtonText()
    {
        var music = GamerPrefs.GetMusicOn();

        soundText      = soundButton.GetComponent <Text>();
        soundText.text = (music == 1) ? "Sound On" : "Sound Off";
        willPlay       = (music == 1) ? true : false;
        HandleMainMenuBgMusic();
    }
Exemple #10
0
    // Use this for initialization
    void Start()
    {
        speed       = -1 * Mathf.Sqrt(speed * speed); // using square root incase speed is negative
        audioSource = GetComponent <AudioSource>();
        int music = GamerPrefs.GetMusicOn();          // 悪い

        willPlay = (music == 1) ? true : false;
        dangos   = -1;
        InitShieldFunc();
    }
    private void HandleMusicButtonText()
    {
        // 音楽
        int music = GamerPrefs.GetMusicOn();         // 悪い

        soundText      = GameObject.Find("Sound Button").GetComponent <Text>();
        soundText.text = (music == 1) ? "Sound On" : "Sound Off";
        willPlay       = (music == 1) ? true : false;
        HandleMainMenuBGMusic();
    }
    // UI Update /////////////////////////////////

    // Game Play /////////////////////////////////

    public void HandleGlassSound()
    {
        if (GamerPrefs.GetMusicOn() == 1)
        {
            willPlayMusic = true;
        }
        else
        {
            willPlayMusic = false;
        }
    }
Exemple #13
0
    public void PlayBackgroundMusic(AudioClip clip)
    {
        var willPlay = GamerPrefs.GetMusicOn() == 1 ? true : false;

        if (!willPlay || bgAudioSource.isPlaying)
        {
            return;
        }
        bgAudioSource.clip = clip;
        bgAudioSource.Play();
    }
Exemple #14
0
    public void ForcePlayBackgroundMusic(AudioClip clip)
    {
        StopBackgroundMusic();
        var willPlay = GamerPrefs.GetMusicOn() == 1 ? true : false;

        if (!willPlay)
        {
            return;
        }
        bgAudioSource.clip = clip;
        bgAudioSource.Play();
    }
Exemple #15
0
    public void PlaySfx(AudioClip clip)
    {
        StopSfx();
        var willPlay = GamerPrefs.GetMusicOn() == 1 ? true : false;

        if (!willPlay)
        {
            return;
        }
        sfxAudioSource.clip = clip;
        sfxAudioSource.Play();
    }
 public void SetFinalScore(int score)
 {
     if (score < GamerPrefs.GetHighScore())
     {
         finalScoreText.text = "Score: " + score;
     }
     else
     {
         // TODO: Maybe play an audio High Score
         finalScoreText.text = "High Score: " + score;
         GamerPrefs.SetHighScore(score);
     }
 }
Exemple #17
0
 public void HandleGameBGMusic()
 {
     _audioSource      = GetComponent <AudioSource>();
     _audioSource.loop = true;
     if (GamerPrefs.GetMusicOn() == 1)
     {
         willPlayMusic = true;
     }
     else
     {
         willPlayMusic = false;
     }
     HandleBGMusicStart();
 }
Exemple #18
0
 public void UpgradeTimeSlow()
 {
     if (!(timeSlow >= Time_Slow_Cap))
     {
         if (balance >= timeSlowUpgrCost)
         {
             balance  -= timeSlowUpgrCost;
             timeSlow += 2;
             GamerPrefs.SetSlowTimeDuration(timeSlow);
             GamerPrefs.SetOkane(balance);
             HandleOkaneBalance();
             HandleTimeSlow();
         }
     }
 }
Exemple #19
0
    public void UpgradeTimeSlow()
    {
        var canUpgradeSlowTime = timeSlow >= TimeSlowCap || balance < timeSlowUpgrCost;

        if (canUpgradeSlowTime)
        {
            return;
        }
        balance  -= timeSlowUpgrCost;
        timeSlow += 2;
        GamerPrefs.SetSlowTimeDuration(timeSlow);
        GamerPrefs.SetMoney(balance);
        HandleOkaneBalance();
        HandleTimeSlow();
    }
Exemple #20
0
    public void UpgradeMaxLife()
    {
        var canUpgradeLife = maxLife >= MaxLifeCap || balance < maxLifeUpgrCost;

        if (canUpgradeLife)
        {
            return;
        }
        balance -= maxLifeUpgrCost;
        maxLife += 1;
        GamerPrefs.SetMaxLife(maxLife);
        GamerPrefs.SetMoney(balance);
        HandleOkaneBalance();
        HandleMaxLife();
    }
Exemple #21
0
    public void UpgradeShield()
    {
        var canUpgradeShield = shieldDuration >= ShieldDurationCap || balance < shildDurationUpgrCost;

        if (canUpgradeShield)
        {
            return;
        }
        balance        -= shildDurationUpgrCost;
        shieldDuration += 2;
        GamerPrefs.SetShieldDuration(shieldDuration);
        GamerPrefs.SetMoney(balance);
        HandleOkaneBalance();
        HandleShield();
    }
Exemple #22
0
 public void UpgradeShield()
 {
     if (!(shieldDuration >= Shield_Duration_Cap))
     {
         if (balance >= shildDurationUpgrCost)
         {
             balance        -= shildDurationUpgrCost;
             shieldDuration += 2;
             GamerPrefs.SetShieldDuration(shieldDuration);
             GamerPrefs.SetOkane(balance);
             HandleOkaneBalance();
             HandleShield();
         }
     }
 }
Exemple #23
0
 public void UpgradeMaxLife()
 {
     if (!(maxLife >= Max_Life_Cap))
     {
         if (balance >= maxLifeUpgrCost)
         {
             balance -= maxLifeUpgrCost;
             maxLife += 1;
             GamerPrefs.SetMaxLife(maxLife);
             GamerPrefs.SetOkane(balance);
             HandleOkaneBalance();
             HandleMaxLife();
         }
     }
 }
Exemple #24
0
 private void HandleTimeSlow()
 {
     timeSlow = GamerPrefs.GetSlowTimeDuration();
     timeSlowAmountText.text = "時 : " + timeSlow.ToString();
     if (timeSlow < TimeSlowCap)
     {
         timeSlowUpgrCost      = (int)((timeSlow * timeSlow) / 2);
         timeSlowCostText.text = "Upgrade Cost 金: " + timeSlowUpgrCost.ToString();
     }
     else
     {
         timeSlowUpgrCost        = int.MaxValue;
         timeSlowCostText.text   = "Fully Upgraded";
         timeSlowButtonText.text = "X";
     }
 }
Exemple #25
0
 private void HandleShield()
 {
     shieldDuration = GamerPrefs.GetShieldDuration();
     shieldDurationAmountText.text = "強 : " + shieldDuration.ToString();
     if (shieldDuration < ShieldDurationCap)
     {
         shildDurationUpgrCost       = (int)((shieldDuration * shieldDuration) / 2);
         shieldDurationCostText.text = "Upgrade Cost 金: " + shildDurationUpgrCost.ToString();
     }
     else
     {
         shildDurationUpgrCost         = int.MaxValue;
         shieldDurationCostText.text   = "Fully Upgraded";
         shieldDurationButtonText.text = "X";
     }
 }
Exemple #26
0
 private void HandleMaxLife()
 {
     maxLife = GamerPrefs.GetMaxLife();
     maxLifeAmountText.text = "心 : " + maxLife.ToString();
     if (maxLife < MaxLifeCap)
     {
         maxLifeUpgrCost      = ((maxLife * 2) * (maxLife * 2)) / 2;
         maxLifeCostText.text = "Upgrade Cost 金: " + maxLifeUpgrCost.ToString();
     }
     else
     {
         maxLifeUpgrCost        = int.MaxValue;
         maxLifeCostText.text   = "Fully Upgraded";
         maxLifeButtonText.text = "X";
     }
 }
Exemple #27
0
 // Use this for initialization
 void Start()
 {
     gameOn         = true;
     score          = 0;
     scoreText.text = "点 : " + score.ToString();
     okane          = 0;
     okaneText.text = "金 : " + okane.ToString();
     currentHP      = maxHP;
     currentWave    = 1;
     InitLife();
     InitMusic();
     timeSlow = GamerPrefs.GetSlowTimeDuration();
     MovingTingsFactory.DUNGO_FACTORY_WORKING = true;
     MovingTingsFactory.CAN_JUMP_WAVES        = false;
     MovingTingsFactory.CAN_SLOW_HUNGER       = false;
     isTimeSlowed = false;
     ShowCurrentWaveToPlayer();
     ResetIndicators();
 }
 // Use this for initialization
 private void Start()
 {
     gameOn         = true;
     score          = 0;
     scoreText.text = "点 : " + score.ToString();
     okane          = 0;
     okaneText.text = "金 : " + okane.ToString();
     currentHp      = maxHP;
     currentWave    = 1;
     InitLife();
     InitMusic();
     timeSlow = GamerPrefs.GetSlowTimeDuration();
     MovingThingsFactory.DungoFactoryWorking = true;
     MovingThingsFactory.CanJumpWaves        = false;
     MovingThingsFactory.CanSlowHunger       = false;
     isTimeSlowed = false;
     ShowCurrentWaveToPlayer();
     ResetIndicators();
 }
    public void HandleSound()
    {
        int music = GamerPrefs.GetMusicOn();

        if (music == 1)
        {
            music = 0;
            GamerPrefs.SetMusicOn(0);
        }
        else
        {
            music = 1;
            GamerPrefs.SetMusicOn(1);
        }
        Text soundText = GameObject.Find("Sound Button").GetComponent <Text>();

        soundText.text = (music == 1) ? "Sound On" : "Sound Off";
        willPlay       = (music == 1) ? true : false;
        HandleMainMenuBGMusic();
    }
    public void SetFinalScore(int score)
    {
        var waveScore = currentWave * 2;
        var servings  = score;

        this.score = servings + waveScore;
        UpdateBankBalance();
        if (this.score < GamerPrefs.GetHighScore())
        {
            deathScoreText.text        = "点 : " + this.score.ToString();
            deathSmallMessageText.text = "Servings: " + servings + "\n+\nWave Bonus: " + waveScore;
            deathPanel.SetActive(true);
        }
        else
        {
            // TODO: Test if this high score scene shit works
            GamerPrefs.SetHighScore(this.score);
            SceneManager.LoadScene("High_SCORE");
        }
    }