Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class WaterSystem : MonoBehaviour
- {
- public static WaterSystem Instance { get; private set; }
- public float waterLevel = 0f; // Set this in the inspector
- private void Awake()
- {
- if (Instance == null)
- {
- Instance = this;
- DontDestroyOnLoad(gameObject);
- }
- else
- {
- Destroy(gameObject);
- }
- }
- public bool IsUnderwater(Vector3 position)
- {
- return position.y < waterLevel;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement