init
This commit is contained in:
commit
862afc9b7a
478 changed files with 197737 additions and 0 deletions
53
Assets/Scripts/Menu.cs
Normal file
53
Assets/Scripts/Menu.cs
Normal file
|
@ -0,0 +1,53 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class Menu : MonoBehaviour{
|
||||
|
||||
public TextMeshProUGUI insertCoin;
|
||||
float playAnimation;
|
||||
bool readyToStart;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start(){
|
||||
InvokeRepeating("InsertCoin", 0, 1);
|
||||
AudioManager.instance.Play("MenuSong");
|
||||
Invoke("Ready", 1);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update(){
|
||||
if (Input.anyKeyDown && readyToStart){
|
||||
CancelInvoke("InsertCoin");
|
||||
InvokeRepeating("Play", 0, .05f);
|
||||
}
|
||||
}
|
||||
|
||||
void Ready(){
|
||||
readyToStart = true;
|
||||
}
|
||||
|
||||
void Play(){
|
||||
if(playAnimation < 10f){
|
||||
if (insertCoin.color.a == 0){
|
||||
insertCoin.color = new Color(insertCoin.color.r, insertCoin.color.g, insertCoin.color.b, 1);
|
||||
}else{
|
||||
insertCoin.color = new Color(insertCoin.color.r, insertCoin.color.g, insertCoin.color.b, 0);
|
||||
}
|
||||
playAnimation++;
|
||||
}else{
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
}
|
||||
|
||||
void InsertCoin(){
|
||||
if(insertCoin.color.a == 0){
|
||||
insertCoin.color = new Color(insertCoin.color.r, insertCoin.color.g, insertCoin.color.b, 1);
|
||||
}else{
|
||||
insertCoin.color = new Color(insertCoin.color.r, insertCoin.color.g, insertCoin.color.b, 0);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue