fixed initial player rotation

This commit is contained in:
nexovec 2022-01-30 12:48:10 +01:00
parent de307fc95b
commit 783946a48c
4 changed files with 24 additions and 11 deletions

View File

@ -55,13 +55,14 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _Glossiness: 0.666
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
@ -73,5 +74,6 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 5.0387836, g: 0, b: 0, a: 1}
- _Color: {r: 0.3679245, g: 0.3679245, b: 0.3679245, a: 1}
- _EmissionColor: {r: 4.3155437, g: 0.14249445, b: 0.14249445, a: 1}
m_BuildTextureStacks: []

View File

@ -5291,7 +5291,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 1942086892, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[3].m_MethodName
value: OnStartGameBtnClick
value: OnNewGameBtnClick
objectReference: {fileID: 0}
- target: {fileID: 1942086892, guid: ec622cf6f0988bc42a99ba84304c15a9, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[3].m_TargetAssemblyTypeName

View File

@ -63,6 +63,7 @@ public class PlayerController : MonoBehaviour
// Update is called once per frame
void Update()
{
if (UiController.isInMenu) return;
rotationX += -Input.GetAxis("Mouse Y") * lookSpeed;
rotationX = Mathf.Clamp(rotationX, -lookXLimit, lookXLimit);
playerCamera.transform.localRotation = Quaternion.Euler(rotationX, 0, 0);
@ -107,21 +108,28 @@ public class PlayerController : MonoBehaviour
isGrounded = false;
}
if (audioSource != null && audioClips.Count > 0) {
if (audioSource != null && audioClips.Count > 0)
{
if ((currentSpeed + speedModifier) > speed * 3f && (currentSpeed + speedModifier) < speed * 6f)
{
if (audioClips.Count > 1 && audioSource.clip != audioClips[1]) {
if (audioClips.Count > 1 && audioSource.clip != audioClips[1])
{
audioSource.Stop();
audioSource.clip = audioClips[1];
audioSource.Play();
}
} else if ((currentSpeed + speedModifier) <= speed * 3f) {
if (audioSource.clip != audioClips[0]) {
}
else if ((currentSpeed + speedModifier) <= speed * 3f)
{
if (audioSource.clip != audioClips[0])
{
audioSource.Stop();
audioSource.clip = audioClips[0];
audioSource.Play();
}
} else if ((currentSpeed + speedModifier) >= speed * 6f) {
}
else if ((currentSpeed + speedModifier) >= speed * 6f)
{
if (audioClips.Count > 2 && audioSource.clip != audioClips[2])
{
audioSource.Stop();

View File

@ -13,6 +13,8 @@ public class UiController : MonoBehaviour
public GameObject menuCamera;
public GameObject playerCamera;
public static bool isInMenu = true;
public static float distance = 0;
public static int highScore = 0;
private float oldDistance = 0.0f;
@ -26,8 +28,9 @@ public class UiController : MonoBehaviour
UiController.LoadGame();
}
public void OnStartGameBtnClick()
public void OnNewGameBtnClick()
{
UiController.isInMenu = false;
menuCamera.SetActive(false);
playerCamera.SetActive(true);
}