40 lines
973 B
C#
40 lines
973 B
C#
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);
|
|
}
|
|
}
|