39 lines
892 B
C#
Raw Normal View History

2025-09-06 17:17:39 +04:00
using System;
using UnityEngine;
using UnityEngine.Rendering;
public class PPDetector : MonoBehaviour
{
public SphereCollider sphereCollider;
public GameObject waterForZone;
public GameObject waterBase;
private void Awake()
{
PlayerEntity.OnDetectPP += Activate;
PlayerEntity.OnDetectClosePP -= DeActivate;
}
private void Activate()
{
waterForZone.SetActive(true);
waterBase.SetActive(false);
}
private void DeActivate()
{
waterForZone.SetActive(false);
waterBase.SetActive(true);
}
private void OnDestroy()
{
PlayerEntity.OnDetectPP -= Activate;
PlayerEntity.OnDetectClosePP -= DeActivate;
}
private void OnDrawGizmosSelected()
{
Gizmos.color = Color.blue;
Gizmos.DrawSphere(this.transform.position, sphereCollider.radius);
}
}