ludumdare50/Assets/Scripts/SafeZone.cs
Yann Dupont 01 afbd15217a Merge dev
2022-04-02 13:52:10 -04:00

30 lines
727 B
C#

using NaughtyAttributes;
using UnityEngine;
public class SafeZone : MonoBehaviour {
[field: SerializeField] [field: Required]
public SafeZoneStats Stats { get; private set; }
[SerializeField] CircleCollider2D moatCollider;
[SerializeField] GameObject globalCamera;
public bool IsInSafeZone { get; private set; } = true;
void Start() {
globalCamera.SetActive(true);
}
public void EnterSafeZone() {
IsInSafeZone = true;
globalCamera.SetActive(true);
}
public void ExitSafeZone() {
IsInSafeZone = false;
globalCamera.SetActive(false);
}
public Vector3 GetOutsidePosition(Vector2 direction) {
return transform.position + (moatCollider.radius + Stats.JumpOffset) * (Vector3)direction;
}
}