using System; using UnityEngine; public abstract class AVRController : MonoBehaviour { public bool IsControllerTypeNew { get { return this.m_bControllerModeNew; } } public AVRControllerButtons VRControllerButtons { get { return this.m_CtrlBtn; } } public OvrMgr.OvrObject.Controller VRControllerObj { get { return this.m_obj_controller; } } public bool HandEnable { get { return this.m_bHandEnable; } set { this.m_bHandEnable = value; } } public Transform UIRayTrans { get { return this.m_trUIRayTrans; } } public bool UIRayEnable { get { return this.m_bUIRayEnable; } set { this.m_bUIRayEnable = value; } } public abstract bool IsHandCameraMode { get; } public abstract bool HandCameraMode { get; set; } public abstract bool IsHandPenMode { get; } public abstract AVRControllerBehavior.LIMIT_MODE HandLimitMode { get; set; } public abstract bool HandModelVisible { get; set; } public abstract bool HandDanceMode { get; set; } public abstract bool HandVRIKMode { get; set; } public abstract bool HandYotogiMode { get; set; } public virtual void Init() { this.m_CtrlBtn = base.GetComponent(); OvrMgr.OvrObject ovr_obj = GameMain.Instance.OvrMgr.ovr_obj; if (base.gameObject.name.ToLower().Contains("left")) { this.m_bHandL = true; this.m_obj_controller = ovr_obj.left_controller; } else if (base.gameObject.name.ToLower().Contains("right")) { this.m_bHandL = false; this.m_obj_controller = ovr_obj.right_controller; } this.m_obj_controller.hand_trans = base.transform; this.m_obj_controller.controller = this; this.m_obj_controller.controller_buttons = this.m_CtrlBtn; Transform transform = base.transform.Find("Grab"); this.m_obj_controller.grip_collider = transform.GetComponent(); this.m_obj_controller.grip_collider.Init(this.m_CtrlBtn); this.m_trHandHit = base.transform.Find("HandHit"); NDebug.Assert(this.m_trHandHit != null); this.m_obj_controller.hand_trans_hit = this.m_trHandHit; this.m_trUIRayTrans = base.transform.Find("UIRay"); NDebug.Assert(this.m_trUIRayTrans != null, "UIRayがみつかりません。"); this.m_VREventGrab = base.GetComponent(); if (this.m_VREventGrab != null) { this.m_VREventGrab.Init(this.m_obj_controller); } } public virtual void ChangeControllerNew(bool f_bNew) { if (f_bNew) { this.m_CtrlBehOld.enabled = false; this.m_CtrlBehNew.enabled = true; this.m_CtrlBehNow = this.m_CtrlBehNew; } else { this.m_CtrlBehNew.enabled = false; this.m_CtrlBehOld.enabled = true; this.m_CtrlBehNow = this.m_CtrlBehOld; } this.m_CtrlBehNow.HandCameraMode = false; this.m_CtrlBehNow.HandLimitMode = AVRControllerBehavior.LIMIT_MODE.NORMAL; this.m_bControllerModeNew = f_bNew; } public virtual void DefaultControllerMode(bool f_bEnable) { if (f_bEnable) { this.ChangeControllerNew(this.m_bControllerModeNew); } else { this.m_CtrlBehOld.enabled = false; this.m_CtrlBehNew.enabled = false; } } public virtual void OnEnable() { this.HandHitReset(); } private void HandHitReset() { if (this.m_trHandHit == null) { return; } int maidCount = GameMain.Instance.CharacterMgr.GetMaidCount(); for (int i = 0; i < maidCount; i++) { Maid maid = GameMain.Instance.CharacterMgr.GetMaid(i); if (maid != null && maid.body0) { if (this.m_bHandL) { maid.body0.m_trHandHitL = this.m_trHandHit; } else { maid.body0.m_trHandHitR = this.m_trHandHit; } } } } public Vector3 GetHandMoveVelocity() { return this.m_CtrlBehNow.GetVelocityHand(); } public float GetHandRotVelocityY() { return this.m_CtrlBehNow.GetRotHandY(); } public Vector3 GetCamMoveVelocity() { return this.m_CtrlBehNow.m_vMoveCam; } public float GetCamRotVelocityY() { return this.m_CtrlBehNow.m_fRotCam; } public bool m_bHandL = true; protected bool m_bHandEnable = true; protected bool m_bControllerModeNew; protected AVRControllerBehavior m_CtrlBehNow; protected AVRControllerBehavior m_CtrlBehOld; protected AVRControllerBehavior m_CtrlBehNew; protected AVRControllerButtons m_CtrlBtn; protected VREventNotifierGrab m_VREventGrab; protected OvrMgr.OvrObject.Controller m_obj_controller; protected Transform m_trUIRayTrans; protected bool m_bUIRayEnable = true; protected Transform m_trHandHit; }