using System; using System.Collections; using UnityEngine; public class FoveEyeRayMgr : MonoBehaviour { private void Start() { } private IEnumerator CoFaceChange(FoveEyeRayMgr.HIT_REGION f_eType) { if (FoveEyeRayMgr.m_TargetMaid != null) { if (this.m_strBackFace != null) { FoveEyeRayMgr.m_TargetMaid.FaceAnime(this.m_strBackFace, 2f, 0); } if (this.m_strBackBlend != null) { FoveEyeRayMgr.m_TargetMaid.FaceBlend(this.m_strBackBlend); } this.m_strBackFace = FoveEyeRayMgr.m_TargetMaid.ActiveFace; this.m_strBackBlend = FoveEyeRayMgr.m_TargetMaid.FaceName3; if (f_eType == FoveEyeRayMgr.HIT_REGION.HEAD) { if (this.m_strBackFace != "優しさ") { FoveEyeRayMgr.m_TargetMaid.FaceAnime("優しさ", 1f, 0); } if (this.m_strBackBlend != "頬1涙0") { FoveEyeRayMgr.m_TargetMaid.FaceBlend("頬1涙0"); } } else if (f_eType == FoveEyeRayMgr.HIT_REGION.BUST) { if (this.m_strBackFace != "困った") { FoveEyeRayMgr.m_TargetMaid.FaceAnime("困った", 1f, 0); } if (this.m_strBackBlend != "頬1涙0") { FoveEyeRayMgr.m_TargetMaid.FaceBlend("頬1涙0"); } } else if (f_eType == FoveEyeRayMgr.HIT_REGION.CROTCH) { if (this.m_strBackFace != "びっくり") { FoveEyeRayMgr.m_TargetMaid.FaceAnime("びっくり", 1f, 0); } if (this.m_strBackBlend != "頬2涙0") { FoveEyeRayMgr.m_TargetMaid.FaceBlend("頬2涙0"); } } this.m_fWaitTime = 5f; do { yield return null; this.m_fWaitTime -= Time.deltaTime; if (this.m_fWaitTime <= 0f) { break; } } while (!(FoveEyeRayMgr.m_TargetMaid == null)); if (FoveEyeRayMgr.m_TargetMaid != null) { FoveEyeRayMgr.m_TargetMaid.FaceAnime(this.m_strBackFace, 2f, 0); FoveEyeRayMgr.m_TargetMaid.FaceBlend(this.m_strBackBlend); } } this.m_coFaceChage = null; yield break; } private void Update() { FoveInterface.EyeRays eyeRays = FoveInterface.GetEyeRays(); this.m_vEyeDirEaseL += (eyeRays.left.direction - this.m_vEyeDirEaseL) * this.EASING; this.m_rayEaseL.origin = eyeRays.left.origin; this.m_rayEaseL.direction = eyeRays.left.direction; this.m_vEyeDirEaseR += (eyeRays.right.direction - this.m_vEyeDirEaseR) * this.EASING; this.m_rayEaseR.origin = eyeRays.right.origin; this.m_rayEaseR.direction = eyeRays.right.direction; bool flag = false; RaycastHit raycastHit; if (Physics.Raycast(this.m_rayEaseL, out raycastHit, float.PositiveInfinity, 131072)) { flag = true; this.m_goCursorLeft.transform.position = raycastHit.point; } else { this.m_goCursorLeft.transform.position = eyeRays.left.GetPoint(3f); } RaycastHit raycastHit2; if (Physics.Raycast(this.m_rayEaseR, out raycastHit2, float.PositiveInfinity, 131072)) { flag = true; this.m_goCursorRight.transform.position = raycastHit2.point; } else { this.m_goCursorRight.transform.position = eyeRays.right.GetPoint(3f); } if (flag && FoveEyeRayMgr.m_TargetMaid != null) { string a = string.Empty; string a2 = string.Empty; if (raycastHit.transform != null) { a = raycastHit.transform.name; } if (raycastHit2.transform != null) { a2 = raycastHit2.transform.name; } FoveEyeRayMgr.HIT_REGION hit_REGION = FoveEyeRayMgr.HIT_REGION.NON; if (a == "OvrGrabHit_Bip01 Head" || a2 == "OvrGrabHit_Bip01 Head") { hit_REGION = FoveEyeRayMgr.HIT_REGION.HEAD; } else if (a == "OvrGrabHit_Mune_L_sub" || a2 == "OvrGrabHit_Mune_L_sub" || a == "OvrGrabHit_Mune_R_sub" || a2 == "OvrGrabHit_Mune_R_sub") { hit_REGION = FoveEyeRayMgr.HIT_REGION.BUST; } else if (a == "OvrGrabHit_Bip01 Pelvis_SCL_" || a2 == "OvrGrabHit_Bip01 Pelvis_SCL_") { hit_REGION = FoveEyeRayMgr.HIT_REGION.CROTCH; } if (hit_REGION == FoveEyeRayMgr.HIT_REGION.NON) { this.m_fLookTimeNow = 0f; } else if (hit_REGION != this.m_hitBefore) { this.m_fLookTimeNow = 0f; if (this.m_coFaceChage != null) { base.StopCoroutine(this.m_coFaceChage); this.m_coFaceChage = null; } } else { this.m_fLookTimeNow += Time.deltaTime; if (this.m_fLookTimeNow > 2f) { if (this.m_coFaceChage == null) { this.m_coFaceChage = base.StartCoroutine(this.CoFaceChange(hit_REGION)); } else { this.m_fWaitTime = 5f; } this.m_fLookTimeNow = 0f; } } this.m_hitBefore = hit_REGION; } else { this.m_fLookTimeNow = 0f; this.m_hitBefore = FoveEyeRayMgr.HIT_REGION.NON; } } public static Maid m_TargetMaid; public GameObject m_goCursorLeft; public GameObject m_goCursorRight; private float m_fLookTimeNow; private Coroutine m_coFaceChage; private float m_fWaitTime = 5f; private string m_strBackFace; private string m_strBackBlend; private FoveEyeRayMgr.HIT_REGION m_hitBefore; private Vector3 m_vEyeDirEaseL; private Vector3 m_vEyeDirEaseR; private Ray m_rayEaseL; private Ray m_rayEaseR; private float EASING = 0.05f; private enum HIT_REGION { NON, HEAD, BUST, CROTCH } }