Beispiel #1
0
    public void UnlockAchievment(int id)
    {
        AudioManager.Instance.Play(onUnlockAchievment, player.transform, channel: AudioManager.AudioChannel.Sound);
        ++openedAchievments;
        AchievmentText t = textsAchievment[id];

        achievmentText.alpha = 0.0f;
        LeanTweenEx.ChangeTextAlpha(achievmentText, 1.0f, 0.5f);
        achievmentText.text = $"{t.textTitle}\n{t.name}\n{t.description}";
        LeanTweenEx.ChangeTextAlpha(achievmentText, 0.0f, 0.5f)
        .setDelay(5.0f)
        .setOnComplete(() => {
            achievmentText.text = "  ";
        });
    }
Beispiel #2
0
 public void Lose()
 {
     if (!isPlaying)
     {
         return;
     }
     if (moveCoroutine != null)
     {
         StopCoroutine(moveCoroutine);
     }
     Crab.transform.position = new Vector3(0, 0, 0);
     Destroy(obstacleClone.gameObject);
     ShowLoseAnimation();
     isPlaying = false;
     LeanTweenEx.ChangeTextAlpha(LoseText, 1.0f, 0.2f);
 }
Beispiel #3
0
    protected override void ShowWinAnimation()
    {
        BlackLines.SetActive(false);
        LeanTweenEx.ChangeTextAlpha(winText, 1.0f, 0.2f);
        if (moveCoroutine != null)
        {
            StopCoroutine(moveCoroutine);
        }
        isPlaying = false;
        Destroy(obstacleClone.gameObject);
        Crab.transform.position = new Vector3(0, 0, 0);
        crabAnimator.SetBool("Won", true);

        float volume = AudioManager.Instance.GetVolume(AudioManager.AudioChannel.Music);

        AudioManager.Instance.SetVolume(AudioManager.AudioChannel.Music, 0.0f);
        AudioManager.Instance.Play(winClip, channel: AudioManager.AudioChannel.Sound);
        LeanTween.delayedCall(4.0f, () =>
        {
            AudioManager.Instance.SetVolume(AudioManager.AudioChannel.Music, volume);
            base.ShowWinAnimation();
        });
    }