mirror of
https://github.com/celisej567/UnitySourceMovement.git
synced 2026-09-27 16:17:09 +03:00
Add files via upload
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CameraWaterCheck : MonoBehaviour {
|
||||
|
||||
private List<Collider> triggers = new List<Collider> ();
|
||||
|
||||
private void OnTriggerEnter (Collider other) {
|
||||
|
||||
if (!triggers.Contains (other))
|
||||
triggers.Add (other);
|
||||
|
||||
}
|
||||
|
||||
private void OnTriggerExit (Collider other) {
|
||||
|
||||
if (triggers.Contains (other))
|
||||
triggers.Remove (other);
|
||||
|
||||
}
|
||||
|
||||
public bool IsUnderwater () {
|
||||
|
||||
foreach (Collider trigger in triggers) {
|
||||
|
||||
if (trigger.GetComponentInParent<Water> ())
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user