init
This commit is contained in:
commit
f5c1616018
679 changed files with 188502 additions and 0 deletions
47
Assets/Scripts/Interface.cs
Normal file
47
Assets/Scripts/Interface.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using DG.Tweening;
|
||||
using SimpleTools.SceneManagement;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class Interface : MonoBehaviour {
|
||||
private static readonly int FadeOut = Animator.StringToHash("Fade");
|
||||
[SerializeField] private TMP_Text title;
|
||||
private bool _titleHidden;
|
||||
|
||||
[SerializeField] private CanvasGroup gameOver;
|
||||
private bool _dead;
|
||||
|
||||
[SerializeField] private Animator anim;
|
||||
|
||||
private void Start() {
|
||||
gameOver.alpha = 0;
|
||||
}
|
||||
|
||||
public void PlacePiece() {
|
||||
if (_titleHidden)
|
||||
return;
|
||||
|
||||
_titleHidden = true;
|
||||
title.DOFade(0f, 2f);
|
||||
}
|
||||
|
||||
public void Die() {
|
||||
if (_dead)
|
||||
return;
|
||||
|
||||
_dead = true;
|
||||
gameOver.DOFade(1f, 1f);
|
||||
}
|
||||
|
||||
public void Retry() {
|
||||
StartCoroutine(RetryRoutine());
|
||||
}
|
||||
|
||||
private IEnumerator RetryRoutine() {
|
||||
anim.SetTrigger(FadeOut);
|
||||
yield return new WaitForSeconds(1f);
|
||||
Loader.Load("Level 1");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue