123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using System;
- using UnityEngine;
- public class PrivateModeEventObject : MonoBehaviour
- {
- public int GetEventNo()
- {
- return this.eventNo;
- }
- public void CreateNewStar()
- {
- GameObject childObject = UTY.GetChildObject(base.gameObject, "top", true);
- if (childObject == null)
- {
- childObject = UTY.GetChildObject(base.gameObject, "Top", false);
- }
- GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("ScenePrivate/Odogu_gp002_SymbolStar")) as GameObject;
- gameObject.transform.SetParent(childObject.transform, false);
- }
- private void Update()
- {
- if (GameMain.Instance.VRMode || !NInput.GetMouseButtonDown(0))
- {
- return;
- }
- if (UICamera.Raycast(Input.mousePosition))
- {
- return;
- }
- Ray ray = GameMain.Instance.MainCamera.camera.ScreenPointToRay(Input.mousePosition);
- RaycastHit raycastHit = default(RaycastHit);
- if (!Physics.Raycast(ray, out raycastHit, float.PositiveInfinity, LayerMask.GetMask(new string[]
- {
- LayerMask.LayerToName(base.gameObject.layer)
- })) || raycastHit.transform != base.transform)
- {
- return;
- }
- if (PrivateModeEventObject.onClickObject != null)
- {
- PrivateModeEventObject.onClickObject(this.eventNo);
- }
- }
- private void OnTriggerEnter(Collider collider)
- {
- if (GameMain.Instance.VRMode && collider.gameObject.layer == LayerMask.NameToLayer("OvrGrabHand") && PrivateModeEventObject.onClickObject != null)
- {
- PrivateModeEventObject.onClickObject(this.eventNo);
- }
- }
- [SerializeField]
- [Header("イベント番号")]
- private int eventNo;
- public static Action<int> onClickObject;
- }
|