21 lines
329 B
C#
21 lines
329 B
C#
using System;
|
|
using UnityEngine;
|
|
|
|
public class ZonePlayerFlagCollision : MonoBehaviour
|
|
{
|
|
public bool safeZone;
|
|
private void OnTriggerEnter2D(Collider2D other)
|
|
{
|
|
if (other.TryGetComponent(out Player isPlayer))
|
|
{
|
|
if (safeZone)
|
|
{
|
|
isPlayer.isSafe = true;
|
|
}
|
|
else
|
|
{
|
|
isPlayer.isSafe = false;
|
|
}
|
|
}
|
|
}
|
|
}
|