| 12345678910111213141516171819 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class CrossHairOutBoundChecker : MonoBehaviour
- {
- [SerializeField] GameObject outTip;
- void Update()
- {
- Rect pr = CrossHair.ins.parentRTF.rect;
- Vector3 lp = CrossHair.ins.transform.localPosition;
- if (Mathf.Abs(lp.x) > pr.width / 2 || Mathf.Abs(lp.y) > pr.height / 2) {
- if (!outTip.activeSelf) outTip.SetActive(true);
- } else {
- if (outTip.activeSelf) outTip.SetActive(false);
- }
- }
- }
|