init
This commit is contained in:
commit
862afc9b7a
478 changed files with 197737 additions and 0 deletions
40
Assets/CompleteGame.cs
Normal file
40
Assets/CompleteGame.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
public class CompleteGame : MonoBehaviour
|
||||
{
|
||||
public int winScene;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
AudioManager.instance.Stop("MenuSong");
|
||||
AudioManager.instance.Play("Theme");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
private void OnTriggerEnter2D(Collider2D collision)
|
||||
{
|
||||
if (collision.tag == "Player")
|
||||
{
|
||||
loadscene(winScene);
|
||||
}
|
||||
}
|
||||
IEnumerator Win(int scene){
|
||||
Time.timeScale = 0;
|
||||
AudioManager.instance.Stop("Theme");
|
||||
yield return new WaitForSecondsRealtime(1f);
|
||||
AudioManager.instance.Play("MenuSong");
|
||||
Time.timeScale = 1;
|
||||
SceneManager.LoadScene(winScene);
|
||||
}
|
||||
public void loadscene(int scene)
|
||||
{
|
||||
SceneManager.LoadScene(scene);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue