private static void FadeOutNoUI(CameraMain __instance) // string __m_BGMName 못가져옴 { if (configEntryUtill["FadeOutNoUI", false]) { MyLog.LogMessage("FadeOutNoUI : " + __instance.GetFadeState()); } }
//Init //=============================== void Start() { Static = this; mainCamera = GetComponent <Camera>(); m_rotationY = -transform.localEulerAngles.x; iCManager.SetObjectIC(mainCamera.gameObject); iCManager.SetObjectIC(floorL); iCManager.SetObjectIC(floorR); oldMousePosition = Input.mousePosition; newMousePosition = Input.mousePosition; pushersw.onSwitch += Pushersw_onSwitch; SwitchNoG.onSwitch += SwitchNoG_onSwitch; pusherFloorSw.onSwitch += PusherFloorSw_onSwitch; pusherlsw.onSwitch += Pusherlsw_onSwitch; pusherlarsw.onSwitch += Pusherlarsw_onSwitch; pusherClear.onSwitch += (object sender, System.EventArgs e) => { StartCoroutine(HideFloorLate()); }; InitUIEvents(); InitAllBulletType(); InitAllBuildType(); Debug.Log("Loaded"); }
public void UpdateText() { if (!IsMine && !bot2) { var mag = (_Player.pos - pos).magnitude; var dist = 200; if (playerNameTxt.enabled || FramesElapsed(10)) { var position = CameraMain.WorldToViewportPoint(pos + Vector3.up) + Vector3.up * .05f; if (playerNameTxt.transform.position.z < 0) { position.y = .1f; position.x = Mathf.Clamp(1f - position.x, .2f, .7f); playerNameTxt.transform.position = position; } playerNameTxt.transform.position = position; playerNameTxt.fontSize = (int)Mathf.Lerp(16, 8, mag / dist); } //if (_Loader.pursuitRace) playerNameTxt.enabled = _Player.voiceChatting || !_Player.IsEnemy(this) || !GameType.weapons || Time.time - lastHitTime < 3 || Time.time - _Game.stateChangeTime < 10; //|| dm ? Time.time - lastHitTime < 3 : _Player.team.players.Any(a => a.Seeing(this)); playerNameTxt.color = (_Player.IsEnemy(this) ? Color.red : Color.green); // -new Color(0, 0, 0, Mathf.Min(.7f, mag / 400f)); } else { playerNameTxt.enabled = false; } }
/// <summary>画面を更新する</summary> public void LateUpdate() { // キー入力で切替える:オン/オフ if (Input.GetKeyDown(m_cfg.KeyTogglePower.ToLower())) { if (m_bActive) { m_bActive = false; // 終了 } else { m_bActive = true; // 開始 m_fTimeOrigin = Time.time; } } if (!m_bActive) { return; // 非アクティブ時は何もしない } CameraMain mainCamera = GameMain.Instance.MainCamera; Transform cameraT = mainCamera.camera.transform; // 移動量を計算 float dT = Time.time - m_fTimeOrigin; float pitch = m_cfg.PitchAmp * Mathf.Sin(m_cfg.PitchFreq * dT); float roll = m_cfg.RollAmp * Mathf.Sin(m_cfg.RollFreq * dT); // 注視点を中心にカメラ移動 Vector3 target = mainCamera.GetTargetPos(); cameraT.RotateAround(target, Vector3.up, pitch); cameraT.RotateAround(target, Vector3.right, roll); // 微妙にバンク?するので正立させる cameraT.LookAt(target, Vector3.up); }
private void Awake() { if (instance == null) { instance = this; mainCam = this.GetComponent <Camera>(); } }
void Start() { mainCamera = FindObjectOfType <CameraMain>(); if (mainCamera == null) { throw new Exception("main is required"); } }
// 元の MoveHeadAndEye 相当の処理 void originalTbodyMoveHeadAndEyeCallback2(TBody tbody, ref Vector3 thatHeadEulerAngle, ref Vector3 thatHeadEulerAngleG, ref Vector3 thatEyeEulerAngle) { TBody that = tbody; CameraMain mainCamera = GameMain.Instance.MainCamera; // eyeTargetWorldPos:ワールド座標系での視線のターゲット位置 Vector3 eyeTargetWorldPos = updateEyeTargetPos(tbody); // HeadToCamPer:最終的に顔がカメラを向く度合い // 0 なら元の頭の向き、1 ならカメラの向き if (that.boHeadToCam) { that.HeadToCamPer += Time.deltaTime * that.HeadToCamFadeSpeed; } else { that.HeadToCamPer -= Time.deltaTime * that.HeadToCamFadeSpeed; } that.HeadToCamPer = Mathf.Clamp01(that.HeadToCamPer); that.boChkEye = false; originalMoveHead(tbody, ref thatHeadEulerAngle, ref thatHeadEulerAngleG, ref thatEyeEulerAngle, eyeTargetWorldPos); if (that.boMAN || that.trsEyeL == null || that.trsEyeR == null) { return; } // 目の追従処理 if (that.boEyeToCam && that.boChkEye) { Vector3 toDirection2 = Quaternion.Inverse(that.trsHead.rotation) * (eyeTargetWorldPos - that.trsHead.position); Quaternion quaternion2 = new Quaternion(); quaternion2.SetFromToRotation(Vector3.up, toDirection2); Vector3 eulerAngles2 = PluginHelper.NormalizeEulerAngles(quaternion2.eulerAngles); Vector3 view = Vector3.Normalize(eyeTargetWorldPos - that.trsEyeL.position); quaternion2.SetLookRotation(view, Vector3.up); Quaternion quaternion3 = quaternion2 * Quaternion.Euler(0.0f, 90f, 0.0f); float num = 0.5f; if (that.boEyeSorashi) { num = 0.05f; } thatEyeEulerAngle = thatEyeEulerAngle * (1f - num) + eulerAngles2 * num; } else { thatEyeEulerAngle = thatEyeEulerAngle * 0.95f; } that.trsEyeL.localRotation = that.quaDefEyeL * Quaternion.Euler(0.0f, thatEyeEulerAngle.x * -0.2f, thatEyeEulerAngle.z * -0.1f); that.trsEyeR.localRotation = that.quaDefEyeR * Quaternion.Euler(0.0f, thatEyeEulerAngle.x * 0.2f, thatEyeEulerAngle.z * 0.1f); }
void Awake() { if (Instance == null) { Instance = this; } else { Debug.Log("Warning: multiple " + this + " in scene!"); } }
void OnLevelWasLoaded(int level) { if (previousLevel == 5) { StoreSettings(); } mainCamera = GameMain.Instance.MainCamera; previousLevel = level; bLevelWasLoaded = true; levelTimer = 0f; }
private void OnLevelWasLoaded(int level) { if (!bg.activeSelf) { bgIndex = 0; bg.SetActive(true); } mainCamera = GameMain.Instance.MainCamera; mainLight = GameMain.Instance.MainLight; lightIntensityDefault = mainLight.light.intensity; }
void OnLevelWasLoaded(int level) { if (previousLevel == 5) { StoreSettings(); } mainCamera = GameMain.Instance.MainCamera; previousLevel = level; bLevelWasLoaded = true; levelTimer = 0f; InitPoseCallback(); }
public MaidManager() { listMaid = new List <Maid>(); listTrs = new List <Transform>(); listName = new List <string>(); iCurrent = -1; sCurrent = "- - -"; cm = GameMain.Instance.CharacterMgr; cameraMain = GameMain.Instance.MainCamera; bUpdateRequest = true; }
public void Callback(TBody tbody) { TBody that = tbody; if (that.trsHead == null) { return; } CameraMain mainCamera = GameMain.Instance.MainCamera; if (mainCamera == null) { return; } try { bool bParamHeadTrack = false; Maid maid = tbody.maid; if (maid != null) { bParamHeadTrack = ExSaveData.GetBool(maid, PluginName, "HEAD_TRACK", false); } Vector3 thatHeadEulerAngle = (Vector3)Helper.GetInstanceField(typeof(TBody), that, "HeadEulerAngle"); Vector3 thatHeadEulerAngleG = (Vector3)Helper.GetInstanceField(typeof(TBody), that, "HeadEulerAngleG"); Vector3 thatEyeEulerAngle = (Vector3)Helper.GetInstanceField(typeof(TBody), that, "EyeEulerAngle"); if (bParamHeadTrack) { ExternalValues externalValues = PluginHelper.GetOrAddComponent <ExternalValues>(tbody.gameObject); externalValues.tbody = tbody; newTbodyMoveHeadAndEyeCallback2(externalValues, tbody, ref thatHeadEulerAngle, ref thatHeadEulerAngleG, ref thatEyeEulerAngle); } else { originalTbodyMoveHeadAndEyeCallback2(tbody, ref thatHeadEulerAngle, ref thatHeadEulerAngleG, ref thatEyeEulerAngle); } Helper.SetInstanceField(typeof(TBody), that, "HeadEulerAngle", thatHeadEulerAngle); Helper.SetInstanceField(typeof(TBody), that, "HeadEulerAngleG", thatHeadEulerAngleG); Helper.SetInstanceField(typeof(TBody), that, "EyeEulerAngle", thatEyeEulerAngle); } catch (Exception ex) { Helper.ShowException(ex); } }
public void OnLevelWasLoaded(int level) { sceneLevel = level; maid = GameMain.Instance.CharacterMgr.GetMaid(0); if (maid) { maidTransform = maid.body0.transform; } bg = GameObject.Find("__GameMain__/BG").transform; mainCamera = GameMain.Instance.MainCamera; if (maid && bg && maidTransform) { allowUpdate = true; } else { allowUpdate = false; } if (occulusVR) { uiObject = GameObject.Find("ovr_screen"); } else { uiObject = GameObject.Find("/UI Root/Camera"); defaultFOV = Camera.main.fieldOfView; } if (level == 5) { GameObject uiRoot = GameObject.Find("/UI Root"); profilePanel = uiRoot.transform.Find("ProfilePanel").gameObject; } else if (level == 12) { GameObject uiRoot = GameObject.Find("/UI Root"); profilePanel = uiRoot.transform.Find("UserEditPanel").gameObject; } fpsMode = false; }
public void Update() { if (_Game) { return; } var r = CameraMain.ScreenPointToRay(Input.mousePosition); RaycastHit h; if (Input.GetMouseButtonDown(1)) { Reset(); } if (Input.GetMouseButtonDown(0) && Physics.Raycast(r, out h)) { Damage(h.point, r.direction); Debug.DrawRay(h.point, h.normal, Color.white, 10); } }
private bool InitializeSceneObjects() { maid = GameMain.Instance.CharacterMgr.GetMaid(0); maidTransform = maid ? maid.body0.transform : null; bg = GameObject.Find("__GameMain__/BG").transform; mainCamera = GameMain.Instance.MainCamera; manHead = null; if (isOVR) { uiObject = GameObject.Find("ovr_screen"); } else { uiObject = GameObject.Find("/UI Root/Camera"); if (uiObject == null) { uiObject = GameObject.Find("SystemUI Root/Camera"); } defaultFoV = Camera.main.fieldOfView; } if (sceneLevel == (int)Scene.SceneEdit) { GameObject uiRoot = GameObject.Find("/UI Root"); profilePanel = uiRoot.transform.Find("ProfilePanel").gameObject; } else if (sceneLevel == (int)Scene.SceneUserEdit) { GameObject uiRoot = GameObject.Find("/UI Root"); profilePanel = uiRoot.transform.Find("UserEditPanel").gameObject; } else { profilePanel = null; } lastCameraPos = Vector3.zero; fpsShakeCorrection = false; fpsMode = false; return(maid && maidTransform && bg && mainCamera); }
Vector3 updateEyeTargetPos(TBody tbody) { TBody that = tbody; CameraMain mainCamera = GameMain.Instance.MainCamera; // eyeTargetWorldPos:ワールド座標系での視線のターゲット位置 Vector3 eyeTargetWorldPos; if (that.trsLookTarget == null) { eyeTargetWorldPos = that.trsHead.TransformPoint(that.offsetLookTarget); if (that.boEyeSorashi) { // num : 顔の前方と顔→カメラベクトルの内積。1.0に近ければ、カメラが顔の正面にある float num = Vector3.Dot( (eyeTargetWorldPos - that.trsHead.position).normalized, (mainCamera.transform.position - that.trsHead.position).normalized); if (that.EyeSorashiCnt > 0) { ++that.EyeSorashiCnt; if (that.EyeSorashiCnt > 200) { that.EyeSorashiCnt = 0; } } // カメラが顔の前方にあり、なおかつ前回の変更から 200 フレーム経過しているなら、新しい「前方」を決める if (num > 0.9f && that.EyeSorashiCnt == 0) { that.offsetLookTarget = !that.EyeSorashiTgl ? new Vector3(-0.6f, 1f, 0.6f) : new Vector3(-0.5f, 1f, -0.7f); that.EyeSorashiTgl = !that.EyeSorashiTgl; that.EyeSorashiCnt = 1; } } } else { eyeTargetWorldPos = that.trsLookTarget.position; } return(eyeTargetWorldPos); }
/// <summary> /// Inits the camera controller variables. /// Made public so that it can be called by classes that require information about the /// camera to be present when initing variables in 'Start' /// </summary> public void InitCameraControllerVariables() { // Get the IPD value (distance between eyes in meters) OVRDevice.GetIPD(ref ipd); // Using the calculated FOV, based on distortion parameters, yeilds the best results. // However, public functions will allow to override the FOV if desired VerticalFOV = CameraMain.GetComponent <OVRCamera>().GetIdealVFOV(); // Get aspect ratio as well AspectRatio = CameraMain.GetComponent <OVRCamera>().CalculateAspectRatio(); // Get our initial world orientation of the cameras from the scene (we can grab it from // the set FollowOrientation object or this OVRCameraController gameObject) if (FollowOrientation != null) { OrientationOffset = FollowOrientation.rotation; } else { OrientationOffset = transform.rotation; } }
public void OnLevelWasLoaded(int level) { sceneLevel = level; maid = GameMain.Instance.CharacterMgr.GetMaid(0); if (maid) { maidTransform = maid.body0.transform; } bg = GameObject.Find("__GameMain__/BG").transform; mainCamera = GameMain.Instance.MainCamera; if (maid && bg && maidTransform) { allowUpdate = true; } else { allowUpdate = false; } if (occulusVR) { uiObject = GameObject.Find("ovr_screen"); } else { uiObject = GameObject.Find("/UI Root/Camera"); //20160103 if (uiObject == null) uiObject = GameObject.Find("SystemUI Root/Camera"); //20160103 ここまで defaultFOV = Camera.main.fieldOfView; } if (level == 5) { GameObject uiRoot = GameObject.Find("/UI Root"); profilePanel = uiRoot.transform.Find("ProfilePanel").gameObject; } else if (level == 12) { GameObject uiRoot = GameObject.Find("/UI Root"); profilePanel = uiRoot.transform.Find("UserEditPanel").gameObject; } //20160103 else if (level == 15) { //profilePanelが何をしているのかよくわからないので適当 GameObject uiRoot = GameObject.Find("__GameMain__/SystemUI Root"); profilePanel = uiRoot.transform.Find("ConfigPanel").gameObject; } cameraOffset = Vector3.zero; bFpsShakeCorrection = false; //20160103 ここまで fpsMode = false; }
// Use this for initialization void Start() { S = this; }
public static bool Intersects(Renderer Renderer) { bool intersectRay = interFrame != Time.frameCount && Renderer.bounds.IntersectRay(CameraMain.ScreenPointToRay(Input.mousePosition)); if (intersectRay) { interFrame = Time.frameCount; } return(intersectRay); }
public MovieCameraTargetTrack() : base() { this.mainCam = GameMain.Instance.MainCamera; this.camCompo = this.mainCam.GetComponent <Camera>(); }
// 新しい MoveHeadAndEye void newTbodyMoveHeadAndEyeCallback2(ExternalValues externalValues, TBody tbody, ref Vector3 thatHeadEulerAngle, ref Vector3 thatHeadEulerAngleG, ref Vector3 thatEyeEulerAngle) { TBody that = tbody; Maid maid = tbody.maid; CameraMain mainCamera = GameMain.Instance.MainCamera; // eyeTarget_world:視線の目標位置(ワールド座標系) Vector3 eyeTarget_world = updateEyeTargetPos(tbody); // HeadToCamPer:最終的に顔がカメラを向く度合い // 0 なら元の頭の向き、1 ならカメラの向き if (that.boHeadToCam) { that.HeadToCamPer += Time.deltaTime * that.HeadToCamFadeSpeed; } else { that.HeadToCamPer -= Time.deltaTime * that.HeadToCamFadeSpeed; } that.HeadToCamPer = Mathf.Clamp01(that.HeadToCamPer); that.boChkEye = false; newMoveHead(externalValues, tbody, ref thatHeadEulerAngle, ref thatHeadEulerAngleG, ref thatEyeEulerAngle, eyeTarget_world); externalValues.prevQuat = that.trsHead.rotation; if (that.boMAN || that.trsEyeL == null || that.trsEyeR == null) { return; } that.boChkEye = false; { float paramEyeAng = ExSaveData.GetFloat(maid, PluginName, "EYE_ANG.angle", 0f); paramEyeAng = Mathf.Clamp(paramEyeAng, -180f, 180f); float paramSpeed = ExSaveData.GetFloat(maid, PluginName, "EYE_TRACK.speed", 0.05f); float paramInside = ExSaveData.GetFloat(maid, PluginName, "EYE_TRACK.inside", 60f); float paramOutside = ExSaveData.GetFloat(maid, PluginName, "EYE_TRACK.outside", 60f); float paramAbove = ExSaveData.GetFloat(maid, PluginName, "EYE_TRACK.above", 40f); float paramBelow = ExSaveData.GetFloat(maid, PluginName, "EYE_TRACK.below", 20f); float paramBehind = ExSaveData.GetFloat(maid, PluginName, "EYE_TRACK.behind", 170f); float paramOfsX = ExSaveData.GetFloat(maid, PluginName, "EYE_TRACK.ofsx", 0f); float paramOfsY = ExSaveData.GetFloat(maid, PluginName, "EYE_TRACK.ofsy", 0f); Vector3 targetPosition = eyeTarget_world; if (!that.boEyeToCam) { // 視線を正面に戻す eyeTarget_world = that.trsHead.TransformPoint(Vector3.up * 1000.0f); } { Transform trsEye = that.trsEyeL; Quaternion defQuat = that.quaDefEyeL * Quaternion.Euler(paramEyeAng, -paramOfsX, -paramOfsY); Quaternion prevQuat = externalValues.prevLeftEyeQuat; Transform trsParent = trsEye.parent; Quaternion newRotation_world = CalcNewEyeRotation( paramOutside, paramInside, paramBelow, paramAbove, paramBehind, trsParent.rotation, trsEye.position, eyeTarget_world ); Quaternion q = Quaternion.Inverse(trsParent.rotation) * newRotation_world; q = Quaternion.Slerp(Quaternion.identity, q, 0.2f); // 眼球モデルの中心に、眼球のトランスフォームの原点が無いため、ごまかしている q = Quaternion.Slerp(prevQuat, q, paramSpeed); prevQuat = q; trsEye.localRotation = q * defQuat; externalValues.prevLeftEyeQuat = prevQuat; } { Transform trsEye = that.trsEyeR; Quaternion defQuat = that.quaDefEyeR * Quaternion.Euler(-paramEyeAng, -paramOfsX, paramOfsY); Quaternion prevQuat = externalValues.prevRightEyeQuat; Transform trsParent = trsEye.parent; Quaternion newRotation_world = CalcNewEyeRotation( paramOutside, paramInside, paramAbove, paramBelow, paramBehind, trsParent.rotation, trsEye.position, eyeTarget_world ); Quaternion q = Quaternion.Inverse(trsParent.rotation) * newRotation_world; q = Quaternion.Slerp(Quaternion.identity, q, 0.2f); q = Quaternion.Slerp(prevQuat, q, paramSpeed); prevQuat = q; trsEye.localRotation = q * defQuat; externalValues.prevRightEyeQuat = prevQuat; } } }
// Start is called before the first frame update void Start() { Camera = GameObject.FindGameObjectWithTag("MainCamera"); C = Camera.GetComponent <CameraMain>(); }
private void Awake() { _inst = this; }
public void OnLevelWasLoaded(int level) { sceneLevel = level; maid = GameMain.Instance.CharacterMgr.GetMaid(0); if (maid) { maidTransform = maid.body0.transform; } bg = GameObject.Find("__GameMain__/BG").transform; mainCamera = GameMain.Instance.MainCamera; if (maid && bg && maidTransform) { allowUpdate = true; } else { allowUpdate = false; } if (occulusVR) { uiObject = GameObject.Find("ovr_screen"); } else { uiObject = GameObject.Find("/UI Root/Camera"); //20160103 if (uiObject == null) { uiObject = GameObject.Find("SystemUI Root/Camera"); } //20160103 ここまで defaultFOV = Camera.main.fieldOfView; } if (level == 5) { GameObject uiRoot = GameObject.Find("/UI Root"); profilePanel = uiRoot.transform.Find("ProfilePanel").gameObject; } else if (level == 12) { GameObject uiRoot = GameObject.Find("/UI Root"); profilePanel = uiRoot.transform.Find("UserEditPanel").gameObject; } //20160103 else if (level == 15) { //profilePanelが何をしているのかよくわからないので適当 GameObject uiRoot = GameObject.Find("__GameMain__/SystemUI Root"); profilePanel = uiRoot.transform.Find("ConfigPanel").gameObject; } cameraOffset = Vector3.zero; bFpsShakeCorrection = false; //20160103 ここまで fpsMode = false; }
void Start() { playerController = GetComponent <PlayerController>(); cam = GetComponentInChildren <CameraMain>(); ball = GetComponentInChildren <BallMove>(); }