Files
2D-Plattformer-Example/Assets/Scripts/Mechanics/VictoryZone.cs
T
2026-04-30 00:53:30 +02:00

22 lines
604 B
C#

using Platformer.Gameplay;
using UnityEngine;
using static Platformer.Core.Simulation;
namespace Platformer.Mechanics
{
/// <summary>
/// Marks a trigger as a VictoryZone, usually used to end the current game level.
/// </summary>
public class VictoryZone : MonoBehaviour
{
void OnTriggerEnter2D(Collider2D collider)
{
var p = collider.gameObject.GetComponent<PlayerController>();
if (p != null)
{
var ev = Schedule<PlayerEnteredVictoryZone>();
ev.victoryZone = this;
}
}
}
}