gimm-platformer-project/Assets/Scripts/Goal.cs

16 lines
363 B
C#
Raw Normal View History

using UnityEngine;
2021-10-21 12:05:56 -06:00
using UnityEngine.SceneManagement;
2022-10-07 14:54:24 -06:00
public class Goal : MonoBehaviour
{
private void OnCollisionEnter2D(Collision2D other)
{
2022-10-07 13:18:54 -06:00
if (other.collider.CompareTag("Player"))
{
Debug.Log("You win!!!");
2021-10-21 12:05:56 -06:00
GetComponent<AudioSource>().Play();
SceneManager.LoadScene("winScreen");
}
}
}