using System; using System.Collections.Generic; using UnityEngine; public class VRLookMgr { public VRLookMgr() { this.m_EyeRay = GameMain.Instance.OvrMgr.OvrCamera.EyeRay; } public void Clear() { } public void FrameStart() { foreach (KeyValuePair> keyValuePair in this.m_dicState) { foreach (KeyValuePair keyValuePair2 in keyValuePair.Value) { keyValuePair2.Value.behNow = VRLookMgr.ELookBehavior.無し; } } if (this.m_EyeRay.RayCast(out this.m_hit, VRLookMgr.m_fMaxDistance, 524288)) { bool flag = false; GameObject gameObject = this.m_hit.transform.gameObject; VRTouchMgr.ETouchPos key = VRTouchMgr.ETouchPos.無し; if (gameObject.name == "OvrTouchHit_Bip01 Spine_SCL_" || gameObject.name == "OvrTouchHit_Bip01 Spine0a_SCL_") { flag = true; key = VRTouchMgr.ETouchPos.お腹; } else if (gameObject.name == "OvrTouchHit_Mune_L_sub" || gameObject.name == "OvrTouchHit_Mune_R_sub") { flag = true; key = VRTouchMgr.ETouchPos.胸; } else if (gameObject.name == "OvrTouchHit_Bip01 Head") { flag = true; key = VRTouchMgr.ETouchPos.頭頂部; } else if (gameObject.name == "OvrTouchHit_Bip01 L Hand" || gameObject.name == "OvrTouchHit_Bip01 R Hand") { flag = true; key = VRTouchMgr.ETouchPos.手; } else if (gameObject.name == "OvrTouchHit_Bip01 Pelvis_SCL_") { flag = true; key = VRTouchMgr.ETouchPos.お尻; } if (flag) { Maid componentInParent = gameObject.GetComponentInParent(); int activeSlotNo = componentInParent.ActiveSlotNo; Dictionary dictionary; if (!this.m_dicState.TryGetValue(activeSlotNo, out dictionary)) { Dictionary dictionary2 = new Dictionary(); this.m_dicState[activeSlotNo] = dictionary2; dictionary = dictionary2; } VRLookMgr.State state; if (!dictionary.TryGetValue(key, out state)) { VRLookMgr.State state2 = new VRLookMgr.State(); dictionary[key] = state2; state = state2; } state.behNow = VRLookMgr.ELookBehavior.見る; state.vHitPos = this.m_hit.point; } } } public void FrameEnd() { foreach (KeyValuePair> keyValuePair in this.m_dicState) { foreach (KeyValuePair keyValuePair2 in keyValuePair.Value) { keyValuePair2.Value.behBef = keyValuePair2.Value.behNow; } } } private bool GetState(int f_nMaidNo, VRTouchMgr.ETouchPos f_checkPos, out VRLookMgr.State f_outState) { f_outState = null; Dictionary dictionary; return this.m_dicState.TryGetValue(f_nMaidNo, out dictionary) && dictionary.TryGetValue(f_checkPos, out f_outState); } public bool GetBehaviorLookDown(VRTouchMgr.ETouchPos f_checkPos, VRLookMgr.ELookBehavior f_checkBeh, int f_nMaidNo, out VRLookMgr.State f_outState) { f_outState = null; VRLookMgr.State state; if (!this.GetState(f_nMaidNo, f_checkPos, out state)) { return false; } if (state.behNow == f_checkBeh && state.behBef != state.behNow) { f_outState = state; return true; } return false; } public bool GetBehaviorTouch(VRTouchMgr.ETouchPos f_checkPos, VRLookMgr.ELookBehavior f_checkBeh, int f_nMaidNo, out VRLookMgr.State f_outState) { f_outState = null; VRLookMgr.State state; if (!this.GetState(f_nMaidNo, f_checkPos, out state)) { return false; } if (state.behNow == f_checkBeh) { f_outState = state; return true; } return false; } public static float m_fMaxDistance = 10f; private RaycastHit m_hit; private Dictionary> m_dicState = new Dictionary>(); private OvrEyeRay m_EyeRay; public enum ELookBehavior { 無し, 見る, MAX } public class State { public VRLookMgr.ELookBehavior behBef; public VRLookMgr.ELookBehavior behNow; public Vector3 vHitPos; } }