feature: Added menu functionality
This commit is contained in:
parent
3b730311fc
commit
38c0bcaef4
9 changed files with 134 additions and 247 deletions
33
Assets/Scripts/Flow/WinScreen.cs
Normal file
33
Assets/Scripts/Flow/WinScreen.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using DG.Tweening;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Flow {
|
||||
public class WinScreen : MonoBehaviour {
|
||||
[SerializeField] private CanvasGroup canvasGroup;
|
||||
|
||||
[SerializeField] private RectTransform winBackground;
|
||||
[SerializeField] private RectTransform winText;
|
||||
|
||||
private bool _hasWon;
|
||||
|
||||
public void Win() {
|
||||
_hasWon = true;
|
||||
|
||||
canvasGroup.blocksRaycasts = true;
|
||||
canvasGroup.DOFade(1f, .5f);
|
||||
|
||||
winBackground.localScale = new Vector3(0, 0, 1);
|
||||
winText.localScale = new Vector3(0, 0, 1);
|
||||
winBackground.DOScale(1f, .25f).SetDelay(.5f).SetEase(Ease.OutBack);
|
||||
winText.DOScale(1f, .25f).SetDelay(.55f).SetEase(Ease.OutBack);
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
if (_hasWon && Input.anyKeyDown) {
|
||||
Application.Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue