public void ApplyDamage(Damageable.DamageMessage msg) { if (msg.damager.name == "Staff") { CameraShake.Shake(0.06f, 0.1f); } float verticalDot = Vector3.Dot(Vector3.up, msg.direction); float horizontalDot = Vector3.Dot(transform.right, msg.direction); Vector3 pushForce = transform.position - msg.damageSource; pushForce.y = 0; transform.forward = -pushForce.normalized; controller.AddForce(pushForce.normalized * 5.5f, false); controller.animator.SetFloat(hashVerticalDot, verticalDot); controller.animator.SetFloat(hashHorizontalDot, horizontalDot); controller.animator.SetTrigger(hashHit); hitAudio.PlayRandomClip(); }
protected void SwitchPauseState() { if (m_InPause && Time.timeScale > 0 || !m_InPause && ScreenFader.IsFading) { return; } if (!alwaysDisplayMouse) { Cursor.lockState = m_InPause ? CursorLockMode.Locked : CursorLockMode.None; Cursor.visible = !m_InPause; } for (int i = 0; i < m_Directors.Length; i++) { if (m_Directors[i].state == PlayState.Playing && !m_InPause) { m_Directors[i].Pause(); } else if (m_Directors[i].state == PlayState.Paused && m_InPause) { m_Directors[i].Resume(); } } if (!m_InPause) { CameraShake.Stop(); } if (m_InPause) { PlayerMyController.Instance.GainControl(); } else { PlayerMyController.Instance.ReleaseControl(); } Time.timeScale = m_InPause ? 1 : 0; if (pauseCanvas) { pauseCanvas.SetActive(!m_InPause); } if (optionsCanvas) { optionsCanvas.SetActive(false); } if (controlsCanvas) { controlsCanvas.SetActive(false); } if (audioCanvas) { audioCanvas.SetActive(false); } m_InPause = !m_InPause; }
protected void SwitchPauseState() { if (m_InPause && Time.timeScale > 0 || !m_InPause && ScreenFader.IsFading) { return; } if (!alwaysDisplayMouse) { Cursor.lockState = m_InPause ? CursorLockMode.Locked : CursorLockMode.None; Cursor.visible = !m_InPause; } for (int i = 0; i < m_Directors.Length; i++) { if (m_Directors[i].state == PlayState.Playing && !m_InPause) { m_Directors[i].Pause(); } else if (m_Directors[i].state == PlayState.Paused && m_InPause) { m_Directors[i].Resume(); } } if (!m_InPause) { CameraShake.Stop(); } if (m_InPause) { PlayerInput.Instance.GainControl(); } else { PlayerInput.Instance.ReleaseControl(); } Time.timeScale = m_InPause ? 1 : 0; if (pauseCanvas) { pauseCanvas.SetActive(!m_InPause); } if (optionsCanvas) { optionsCanvas.SetActive(false); } if (controlsCanvas) { controlsCanvas.SetActive(false); } if (audioCanvas) { audioCanvas.SetActive(false); } if (heatmapCanvas) { heatmapCanvas.SetActive(false); } if (!m_InPause) { //========================================================================================= Dictionary <string, object> myDic = new Dictionary <string, object>(); //Type myDic.Add("Type", "OpenMenu"); //Transform myDic.Add("PositionX", transform.position.x); myDic.Add("PositionY", transform.position.y); myDic.Add("PositionZ", transform.position.z); //TimeStamp myDic.Add("TimeStamp", Time.time); //PlayerID myDic.Add("PlayerID", /*PlayerData.player_id*/ 0); PlayerEventTrack.EventList.Add(myDic); Debug.Log("Player OpenMenu"); //========================================================================================= } m_InPause = !m_InPause; }