mirror of
https://github.com/celisej567/forest.git
synced 2026-09-17 20:08:53 +03:00
1
This commit is contained in:
@@ -15,6 +15,9 @@ public class CameraBob : MonoBehaviour
|
||||
CharacterController controller;
|
||||
public bool IsRotating = false;
|
||||
|
||||
//public int XRotStop = 1000;
|
||||
//public int YRotStop = 1000;
|
||||
|
||||
Vector3 StartPos;
|
||||
Quaternion StartRot;
|
||||
|
||||
@@ -57,25 +60,26 @@ public class CameraBob : MonoBehaviour
|
||||
if (!IsRotating)
|
||||
PlayMotion(FootStepMotion());
|
||||
else
|
||||
PlayMotion(FootStepRotation());
|
||||
return;
|
||||
//PlayMotion(FootStepRotation());
|
||||
}
|
||||
|
||||
Vector3 FootStepMotion()
|
||||
{
|
||||
Vector3 pos = Vector3.zero;
|
||||
pos.y += Mathf.Sin(Time.time * Frequency) * Amplitude;
|
||||
pos.x += Mathf.Cos(Time.time * Frequency / 2) * Amplitude *2;
|
||||
pos.y += Mathf.Cos(Time.time * Frequency) * Amplitude;
|
||||
pos.x += Mathf.Sin(Time.time * Frequency / 2) * Amplitude *2;
|
||||
return pos;
|
||||
}
|
||||
|
||||
/*
|
||||
Quaternion FootStepRotation()
|
||||
{
|
||||
Quaternion pos = new Quaternion(0,0,0,0);
|
||||
pos.y += Mathf.Sin(Time.time * Frequency) * Amplitude;
|
||||
pos.x += Mathf.Cos(Time.time * Frequency / 2) * Amplitude * 2;
|
||||
pos.y += Mathf.Sin(Time.time * Frequency) * (Amplitude / YRotStop);
|
||||
pos.x += Mathf.Cos(Time.time * Frequency / 2) * (Amplitude / XRotStop);
|
||||
return pos;
|
||||
}
|
||||
|
||||
*/
|
||||
void ResetPosition()
|
||||
{
|
||||
if (!IsRotating)
|
||||
@@ -86,6 +90,7 @@ public class CameraBob : MonoBehaviour
|
||||
else
|
||||
{
|
||||
if (Camera.localRotation == StartRot) return;
|
||||
Camera.localRotation = Quaternion.Lerp(Camera.localRotation, StartRot, Time.deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,16 +50,16 @@ public class CameraMovement : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerator PauseGame()
|
||||
IEnumerable PauseGame()
|
||||
{
|
||||
SceneManager.LoadSceneAsync("pause", LoadSceneMode.Additive);
|
||||
Time.timeScale = 0;
|
||||
return null;
|
||||
}
|
||||
|
||||
IEnumerator UnPauseGame()
|
||||
IEnumerable UnPauseGame()
|
||||
{
|
||||
SceneManager.UnloadSceneAsync("pause" );
|
||||
SceneManager.UnloadSceneAsync("pause");
|
||||
Time.timeScale = 1;
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user