RitterRun/Assets/Scripts/FlagScript.cs

24 lines
469 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class FlagScript : MonoBehaviour
{
private void OnTriggerEnter2D(Collider2D other)
{
if (other.CompareTag("Player"))
{
Debug.Log("Spieler hat die Flagge berührt! Level gewonnen!");
WinLevel();
}
}
private void WinLevel()
{
SceneManager.LoadScene("NextLevel");
}
}