using Obvious.Soap; using SoapCustomVariable; using UnityEngine; public class FishDebug : MonoBehaviour { public BoolVariable ISeeFishDebug; private bool _isDebugEnabled; private FishController _fishController; private FishAI _fishAI; private void OnEnable() { _fishController = GetComponent(); _fishAI = GetComponent(); SeeFishDebugOnOnValueChanged(ISeeFishDebug); ISeeFishDebug.OnValueChanged += SeeFishDebugOnOnValueChanged; } private void OnDisable() { ISeeFishDebug.OnValueChanged -= SeeFishDebugOnOnValueChanged; } private void SeeFishDebugOnOnValueChanged(bool obj) { _isDebugEnabled = obj; } private void OnGUI() { if (!_isDebugEnabled) { return; } Camera main = Camera.main; if (main == null) { return; } Vector3 vector = main.WorldToScreenPoint(base.transform.position); float x = vector.x; float num = (float)Screen.height - vector.y - 40f; if (!(vector.z > 0f) || !(vector.x > 0f) || !(vector.x < (float)Screen.width) || !(vector.y > 0f) || !(vector.y < (float)Screen.height) || (_fishController.currentFightFishObject.Value != null && _fishController.currentFightFishObject.Value != base.gameObject)) { return; } GUI.DrawTexture(new Rect(x - 20f, num + 25f, 10f, 10f), Texture2D.whiteTexture); if (_fishController.fishState.Value != FishState.fight) { string text = _fishController.name.Replace("(Clone)", string.Empty) ?? ""; GUI.Label(new Rect(x, num + 20f, 300f, 20f), text); return; } string[] array = new string[5] { $"stamina: {_fishController.stamina}", $"reach: {_fishAI.isTargetReached}", $"{_fishController.moveSpeed} m/s", _fishController.fishState.Value.ToString() ?? "", _fishController.name.Replace("(Clone)", string.Empty) ?? "" }; for (int i = 0; i < array.Length; i++) { GUI.Label(new Rect(x, num - (float)(i * 20), 300f, 20f), array[i]); } } }