39 lines
892 B
C#
39 lines
892 B
C#
|
|
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);
|
|||
|
|
}
|
|||
|
|
}
|