diff --git a/Assets/Prefabs/Player.prefab b/Assets/Prefabs/Player.prefab index 0ac5662..ebc820d 100644 --- a/Assets/Prefabs/Player.prefab +++ b/Assets/Prefabs/Player.prefab @@ -1606,7 +1606,7 @@ Rigidbody: m_IsKinematic: 0 m_Interpolate: 0 m_Constraints: 112 - m_CollisionDetection: 2 + m_CollisionDetection: 1 --- !u!114 &3244356566819001086 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Prefabs/platforms/Platform_Blue.prefab b/Assets/Prefabs/platforms/Platform_Blue.prefab index 7bf38a6..4336e2f 100644 --- a/Assets/Prefabs/platforms/Platform_Blue.prefab +++ b/Assets/Prefabs/platforms/Platform_Blue.prefab @@ -98,6 +98,7 @@ GameObject: - component: {fileID: 1430690303722568316} - component: {fileID: 8238111678033492397} - component: {fileID: -5509448037057392871} + - component: {fileID: 2527761051471871889} m_Layer: 0 m_Name: Platform_Blue m_TagString: platform @@ -201,6 +202,11 @@ MonoBehaviour: m_EditorClassIdentifier: type: 2 speed: 20 + audioSource: {fileID: 2527761051471871889} + audioClips: + - {fileID: 8300000, guid: e25b1f5c308fe154a8d7203703e2f298, type: 3} + - {fileID: 8300000, guid: 069524b961ce90248975f0b336aaa1ea, type: 3} + - {fileID: 8300000, guid: 8bdd4da8e56531349a71d10986d156ae, type: 3} --- !u!65 &8238111678033492397 BoxCollider: m_ObjectHideFlags: 0 @@ -208,7 +214,7 @@ BoxCollider: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8768991388683709947} - m_Material: {fileID: 13400000, guid: 055b414bc685d41409a41f4ea2d64231, type: 2} + m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 @@ -226,3 +232,99 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 61dae18984b7ff147ab1d77fb817687a, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!82 &2527761051471871889 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8768991388683709947} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 0 + m_Volume: 0.3 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 diff --git a/Assets/Prefabs/platforms/Platform_Green.prefab b/Assets/Prefabs/platforms/Platform_Green.prefab index c46a878..d6567c6 100644 --- a/Assets/Prefabs/platforms/Platform_Green.prefab +++ b/Assets/Prefabs/platforms/Platform_Green.prefab @@ -202,6 +202,8 @@ MonoBehaviour: m_EditorClassIdentifier: type: 0 speed: 5 + audioSource: {fileID: 0} + audioClips: [] --- !u!65 &3865253352867341094 BoxCollider: m_ObjectHideFlags: 0 @@ -209,7 +211,7 @@ BoxCollider: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8768991388683709947} - m_Material: {fileID: 13400000, guid: 055b414bc685d41409a41f4ea2d64231, type: 2} + m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 diff --git a/Assets/Prefabs/platforms/Platform_Orange.prefab b/Assets/Prefabs/platforms/Platform_Orange.prefab index 901a67b..0b32797 100644 --- a/Assets/Prefabs/platforms/Platform_Orange.prefab +++ b/Assets/Prefabs/platforms/Platform_Orange.prefab @@ -114,6 +114,7 @@ GameObject: - component: {fileID: 1183598848765291555} - component: {fileID: 6218203028538785626} - component: {fileID: 1204402889283165505} + - component: {fileID: 7973800414101489524} m_Layer: 0 m_Name: Platform_Orange m_TagString: platform @@ -201,6 +202,12 @@ MonoBehaviour: m_EditorClassIdentifier: type: 6 speed: 10 + audioSource: {fileID: 7973800414101489524} + audioClips: + - {fileID: 8300000, guid: 0f9bc2d26d3715c42addd8d0afbe743f, type: 3} + - {fileID: 8300000, guid: df1b4f1fff31d34448627e9a2f26eb49, type: 3} + - {fileID: 8300000, guid: bc1f76da471aaa0428b17fae63dc7070, type: 3} + - {fileID: 8300000, guid: 497af8c6f4c09474f9934696a2a41a40, type: 3} --- !u!65 &6218203028538785626 BoxCollider: m_ObjectHideFlags: 0 @@ -208,7 +215,7 @@ BoxCollider: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 6650340373999088090} - m_Material: {fileID: 13400000, guid: 055b414bc685d41409a41f4ea2d64231, type: 2} + m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 @@ -226,3 +233,99 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 61dae18984b7ff147ab1d77fb817687a, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!82 &7973800414101489524 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6650340373999088090} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 0 + m_Volume: 0.1 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 diff --git a/Assets/Prefabs/platforms/Platform_Red.prefab b/Assets/Prefabs/platforms/Platform_Red.prefab index 0edad5c..10ebefb 100644 --- a/Assets/Prefabs/platforms/Platform_Red.prefab +++ b/Assets/Prefabs/platforms/Platform_Red.prefab @@ -114,6 +114,7 @@ GameObject: - component: {fileID: 3861707493128515586} - component: {fileID: 5316890779910729157} - component: {fileID: -142748814437030588} + - component: {fileID: 5862113707430629064} m_Layer: 0 m_Name: Platform_Red m_TagString: platform @@ -200,7 +201,12 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: type: 1 - speed: 5 + speed: 10 + audioSource: {fileID: 5862113707430629064} + audioClips: + - {fileID: 8300000, guid: e25b1f5c308fe154a8d7203703e2f298, type: 3} + - {fileID: 8300000, guid: 069524b961ce90248975f0b336aaa1ea, type: 3} + - {fileID: 8300000, guid: 8bdd4da8e56531349a71d10986d156ae, type: 3} --- !u!65 &5316890779910729157 BoxCollider: m_ObjectHideFlags: 0 @@ -208,7 +214,7 @@ BoxCollider: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8768991388683709947} - m_Material: {fileID: 13400000, guid: 055b414bc685d41409a41f4ea2d64231, type: 2} + m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 @@ -226,3 +232,99 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 61dae18984b7ff147ab1d77fb817687a, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!82 &5862113707430629064 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8768991388683709947} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 0 + m_Volume: 0.3 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 diff --git a/Assets/Prefabs/platforms/Platform_yellow.prefab b/Assets/Prefabs/platforms/Platform_yellow.prefab index e17cf6c..3997000 100644 --- a/Assets/Prefabs/platforms/Platform_yellow.prefab +++ b/Assets/Prefabs/platforms/Platform_yellow.prefab @@ -114,6 +114,7 @@ GameObject: - component: {fileID: 7821003709828495146} - component: {fileID: 4344779564172896453} - component: {fileID: 5433657018731068073} + - component: {fileID: 8383421295717427161} m_Layer: 0 m_Name: Platform_yellow m_TagString: platform @@ -201,6 +202,12 @@ MonoBehaviour: m_EditorClassIdentifier: type: 5 speed: 10 + audioSource: {fileID: 8383421295717427161} + audioClips: + - {fileID: 8300000, guid: 42674630e9bd347408c6a2e84b1cc948, type: 3} + - {fileID: 8300000, guid: e92cb7ffeb685484fb49188542ab07a0, type: 3} + - {fileID: 8300000, guid: 4285bbaea081a6f4490fd8a485408977, type: 3} + - {fileID: 8300000, guid: a9f86995a34d2594c8688021b82a4fbe, type: 3} --- !u!65 &4344779564172896453 BoxCollider: m_ObjectHideFlags: 0 @@ -208,7 +215,7 @@ BoxCollider: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 8768991388683709947} - m_Material: {fileID: 13400000, guid: 055b414bc685d41409a41f4ea2d64231, type: 2} + m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 @@ -226,3 +233,99 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 61dae18984b7ff147ab1d77fb817687a, type: 3} m_Name: m_EditorClassIdentifier: +--- !u!82 &8383421295717427161 +AudioSource: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8768991388683709947} + m_Enabled: 1 + serializedVersion: 4 + OutputAudioMixerGroup: {fileID: 0} + m_audioClip: {fileID: 0} + m_PlayOnAwake: 0 + m_Volume: 0.1 + m_Pitch: 1 + Loop: 0 + Mute: 0 + Spatialize: 0 + SpatializePostEffects: 0 + Priority: 128 + DopplerLevel: 1 + MinDistance: 1 + MaxDistance: 500 + Pan2D: 0 + rolloffMode: 0 + BypassEffects: 0 + BypassListenerEffects: 0 + BypassReverbZones: 0 + rolloffCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + panLevelCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + spreadCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + reverbZoneMixCustomCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0.33333334 + outWeight: 0.33333334 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 diff --git a/Assets/Prefabs/platforms/platform 2 power.prefab b/Assets/Prefabs/platforms/platform 2 power.prefab index cc45524..1e0fbfe 100644 --- a/Assets/Prefabs/platforms/platform 2 power.prefab +++ b/Assets/Prefabs/platforms/platform 2 power.prefab @@ -177,7 +177,7 @@ BoxCollider: m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 7678802340880963262} - m_Material: {fileID: 13400000, guid: 055b414bc685d41409a41f4ea2d64231, type: 2} + m_Material: {fileID: 0} m_IsTrigger: 0 m_Enabled: 1 serializedVersion: 2 @@ -197,6 +197,8 @@ MonoBehaviour: m_EditorClassIdentifier: type: 0 speed: 5 + audioSource: {fileID: 0} + audioClips: [] --- !u!114 &-731181381576803345 MonoBehaviour: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/PlatformManager.cs b/Assets/Scripts/PlatformManager.cs index bbfb56a..2184700 100644 --- a/Assets/Scripts/PlatformManager.cs +++ b/Assets/Scripts/PlatformManager.cs @@ -7,6 +7,8 @@ public class PlatformManager : MonoBehaviour public enum PlatformType {Basic, Pull, Push, RotateZ, RotateY, SpeedUp, SpeedDown}; public PlatformType type = PlatformType.Pull; public float speed = 5; + public AudioSource audioSource; + public List audioClips = new List(); void FixedUpdate() { @@ -17,4 +19,12 @@ public class PlatformManager : MonoBehaviour transform.Rotate(transform.up * speed * Time.deltaTime); } } + + public void Step() + { + if (audioSource != null && audioClips.Count > 0 && !audioSource.isPlaying) + { + audioSource.PlayOneShot(audioClips[Random.Range(0, audioClips.Count)]); + } + } } diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index 68467ac..e569d00 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -85,7 +85,7 @@ public class PlayerController : MonoBehaviour } float curSpeedX = canMove ? (currentSpeed + speedModifier) : 0; - float curSpeedY = canMove ? (currentSpeed + 3.5f + speedModifier) * Input.GetAxis("Horizontal") : 0; + float curSpeedY = canMove ? (currentSpeed + 5f + speedModifier) * Input.GetAxis("Horizontal") : 0; moveDirection = (platformForward * curSpeedX * Time.deltaTime) + (transform.right * curSpeedY * Time.deltaTime); @@ -105,7 +105,7 @@ public class PlayerController : MonoBehaviour } if (audioSource != null && audioClips.Count > 0) { - if ((currentSpeed + speedModifier) > speed * 3f && (currentSpeed + speedModifier) < speed * 7f) + if ((currentSpeed + speedModifier) > speed * 3f && (currentSpeed + speedModifier) < speed * 6f) { if (audioClips.Count > 1 && audioSource.clip != audioClips[1]) { audioSource.Stop(); @@ -118,7 +118,7 @@ public class PlayerController : MonoBehaviour audioSource.clip = audioClips[0]; audioSource.Play(); } - } else if ((currentSpeed + speedModifier) >= speed * 7f) { + } else if ((currentSpeed + speedModifier) >= speed * 6f) { if (audioClips.Count > 2 && audioSource.clip != audioClips[2]) { audioSource.Stop(); @@ -136,7 +136,7 @@ public class PlayerController : MonoBehaviour if (inAir) { // Debug.Log("Jump"); - rb.AddForce(transform.up * jumpSpeed * 100 * Time.deltaTime, ForceMode.Impulse); + rb.AddForce(transform.up * jumpSpeed * 100f * Time.deltaTime, ForceMode.Impulse); inAir = false; } @@ -219,10 +219,10 @@ public class PlayerController : MonoBehaviour if (other.GetContact(0).normal == other.transform.forward || other.GetContact(0).normal == -other.transform.forward + || other.GetContact(0).normal == -other.transform.right + || other.GetContact(0).normal == other.transform.right || (other.GetContact(0).normal != -other.transform.up - && other.GetContact(0).normal != other.transform.up - && other.GetContact(0).normal != other.transform.right - && other.GetContact(0).normal != -other.transform.right) + && other.GetContact(0).normal != other.transform.up) ) { return; @@ -240,24 +240,10 @@ public class PlayerController : MonoBehaviour isGrounded = true; if (other.gameObject.tag == "platform") { - - if (other.GetContact(0).normal == other.transform.forward - || other.GetContact(0).normal == -other.transform.forward - || (other.GetContact(0).normal != -other.transform.up - && other.GetContact(0).normal != other.transform.up - && other.GetContact(0).normal != other.transform.right - && other.GetContact(0).normal != -other.transform.right) - ) - { - return; - } - - saveDirection = -other.GetContact(0).normal; - - Vector3 gDirection = -other.GetContact(0).normal; PlatformManager platform = other.gameObject.GetComponent(); if (platform != null) { + platform.Step(); switch (platform.type) { case PlatformManager.PlatformType.Push: @@ -285,14 +271,24 @@ public class PlayerController : MonoBehaviour speedModifier = 0.0f; } break; - default: - gDirection = -other.GetContact(0).normal; - break; } } - else + if (other.GetContact(0).normal == other.transform.forward + || other.GetContact(0).normal == -other.transform.forward + || other.GetContact(0).normal == -other.transform.right + || other.GetContact(0).normal == other.transform.right + || (other.GetContact(0).normal != -other.transform.up + && other.GetContact(0).normal != other.transform.up) + ) { - gDirection = -transform.up; + return; + } + + Vector3 gDirection = -other.GetContact(0).normal; + saveDirection = gDirection; + if (platform == null) + { + gDirection = -other.GetContact(0).normal; } platformForward = other.transform.forward; this.downDirection = gDirection; diff --git a/Assets/Scripts/ProceduralGeneration.cs b/Assets/Scripts/ProceduralGeneration.cs index 54b5621..b2ea1a5 100644 --- a/Assets/Scripts/ProceduralGeneration.cs +++ b/Assets/Scripts/ProceduralGeneration.cs @@ -47,7 +47,7 @@ public class ProceduralGeneration : MonoBehaviour List spawnSpiralOfPlatforms(GameObject lastObject, GameObject objToSpawn, GameObject parentLevelObject) { // configuration: - float horizontalDistancePerPlatform = (float)Random.Range(0.5f, 2.0f); + float horizontalDistancePerPlatform = (float)Random.Range(1.0f, 3.0f); List levelBlocksSpawnTemp = new List(); // Debug.Log("Building LOOP"); @@ -102,7 +102,7 @@ public class ProceduralGeneration : MonoBehaviour for (var i = 0; i < this.spawnedLevelBlocks.Count; i++) { float distance = Vector3.Distance(this.spawnedLevelBlocks[i].transform.position, playerPosition); - if (distance > this.maximumDistanceOfPlatformFromPlayer && this.spawnedLevelBlocks.Count >= this.maximumNumberOfPlatformsAtScene) + if (distance > this.maximumDistanceOfPlatformFromPlayer && this.spawnedLevelBlocks.Count >= this.maximumNumberOfPlatformsAtScene && playerPosition.z > this.spawnedLevelBlocks[i].transform.position.z) { Destroy(this.spawnedLevelBlocks[i]); this.spawnedLevelBlocks.Remove(this.spawnedLevelBlocks[i]); diff --git a/Assets/Sounds/Magnets.meta b/Assets/Sounds/Magnets.meta new file mode 100644 index 0000000..9f2616f --- /dev/null +++ b/Assets/Sounds/Magnets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6f7627d76e56c724b978e5b6e15a6e6d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/Magnets/Magnet01.mp3 b/Assets/Sounds/Magnets/Magnet01.mp3 new file mode 100644 index 0000000..2ca4f8b Binary files /dev/null and b/Assets/Sounds/Magnets/Magnet01.mp3 differ diff --git a/Assets/Sounds/Magnets/Magnet01.mp3.meta b/Assets/Sounds/Magnets/Magnet01.mp3.meta new file mode 100644 index 0000000..1f404c7 --- /dev/null +++ b/Assets/Sounds/Magnets/Magnet01.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: e25b1f5c308fe154a8d7203703e2f298 +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/Magnets/Magnet02.mp3 b/Assets/Sounds/Magnets/Magnet02.mp3 new file mode 100644 index 0000000..a5fbc74 Binary files /dev/null and b/Assets/Sounds/Magnets/Magnet02.mp3 differ diff --git a/Assets/Sounds/Magnets/Magnet02.mp3.meta b/Assets/Sounds/Magnets/Magnet02.mp3.meta new file mode 100644 index 0000000..3a508a4 --- /dev/null +++ b/Assets/Sounds/Magnets/Magnet02.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 069524b961ce90248975f0b336aaa1ea +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/Magnets/Magnet03.mp3 b/Assets/Sounds/Magnets/Magnet03.mp3 new file mode 100644 index 0000000..8a3b3e7 Binary files /dev/null and b/Assets/Sounds/Magnets/Magnet03.mp3 differ diff --git a/Assets/Sounds/Magnets/Magnet03.mp3.meta b/Assets/Sounds/Magnets/Magnet03.mp3.meta new file mode 100644 index 0000000..c83cc00 --- /dev/null +++ b/Assets/Sounds/Magnets/Magnet03.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 8bdd4da8e56531349a71d10986d156ae +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/SlowDown.meta b/Assets/Sounds/SlowDown.meta new file mode 100644 index 0000000..4b3c3de --- /dev/null +++ b/Assets/Sounds/SlowDown.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bc9bdfba777b8fe459f8df308f1abf8b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/SlowDown/SlowDown01.mp3 b/Assets/Sounds/SlowDown/SlowDown01.mp3 new file mode 100644 index 0000000..3c3bd88 Binary files /dev/null and b/Assets/Sounds/SlowDown/SlowDown01.mp3 differ diff --git a/Assets/Sounds/SlowDown/SlowDown01.mp3.meta b/Assets/Sounds/SlowDown/SlowDown01.mp3.meta new file mode 100644 index 0000000..0f872d4 --- /dev/null +++ b/Assets/Sounds/SlowDown/SlowDown01.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 0f9bc2d26d3715c42addd8d0afbe743f +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/SlowDown/SlowDown02.mp3 b/Assets/Sounds/SlowDown/SlowDown02.mp3 new file mode 100644 index 0000000..9390d52 Binary files /dev/null and b/Assets/Sounds/SlowDown/SlowDown02.mp3 differ diff --git a/Assets/Sounds/SlowDown/SlowDown02.mp3.meta b/Assets/Sounds/SlowDown/SlowDown02.mp3.meta new file mode 100644 index 0000000..083e459 --- /dev/null +++ b/Assets/Sounds/SlowDown/SlowDown02.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: df1b4f1fff31d34448627e9a2f26eb49 +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/SlowDown/SlowDown03.mp3 b/Assets/Sounds/SlowDown/SlowDown03.mp3 new file mode 100644 index 0000000..34d5209 Binary files /dev/null and b/Assets/Sounds/SlowDown/SlowDown03.mp3 differ diff --git a/Assets/Sounds/SlowDown/SlowDown03.mp3.meta b/Assets/Sounds/SlowDown/SlowDown03.mp3.meta new file mode 100644 index 0000000..57cd301 --- /dev/null +++ b/Assets/Sounds/SlowDown/SlowDown03.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: bc1f76da471aaa0428b17fae63dc7070 +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/SlowDown/SlowDown04.mp3 b/Assets/Sounds/SlowDown/SlowDown04.mp3 new file mode 100644 index 0000000..d3497bc Binary files /dev/null and b/Assets/Sounds/SlowDown/SlowDown04.mp3 differ diff --git a/Assets/Sounds/SlowDown/SlowDown04.mp3.meta b/Assets/Sounds/SlowDown/SlowDown04.mp3.meta new file mode 100644 index 0000000..a862323 --- /dev/null +++ b/Assets/Sounds/SlowDown/SlowDown04.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 497af8c6f4c09474f9934696a2a41a40 +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/SpeedUp.meta b/Assets/Sounds/SpeedUp.meta new file mode 100644 index 0000000..fa1f249 --- /dev/null +++ b/Assets/Sounds/SpeedUp.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 8f252e5f5885a5f49bb259dedb2fe565 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/SpeedUp/SpeedUp01.mp3 b/Assets/Sounds/SpeedUp/SpeedUp01.mp3 new file mode 100644 index 0000000..8ca5009 Binary files /dev/null and b/Assets/Sounds/SpeedUp/SpeedUp01.mp3 differ diff --git a/Assets/Sounds/SpeedUp/SpeedUp01.mp3.meta b/Assets/Sounds/SpeedUp/SpeedUp01.mp3.meta new file mode 100644 index 0000000..9566e9b --- /dev/null +++ b/Assets/Sounds/SpeedUp/SpeedUp01.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 42674630e9bd347408c6a2e84b1cc948 +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/SpeedUp/SpeedUp02.mp3 b/Assets/Sounds/SpeedUp/SpeedUp02.mp3 new file mode 100644 index 0000000..a8a6ba3 Binary files /dev/null and b/Assets/Sounds/SpeedUp/SpeedUp02.mp3 differ diff --git a/Assets/Sounds/SpeedUp/SpeedUp02.mp3.meta b/Assets/Sounds/SpeedUp/SpeedUp02.mp3.meta new file mode 100644 index 0000000..2b0d7eb --- /dev/null +++ b/Assets/Sounds/SpeedUp/SpeedUp02.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: e92cb7ffeb685484fb49188542ab07a0 +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/SpeedUp/SpeedUp03.mp3 b/Assets/Sounds/SpeedUp/SpeedUp03.mp3 new file mode 100644 index 0000000..dab5c31 Binary files /dev/null and b/Assets/Sounds/SpeedUp/SpeedUp03.mp3 differ diff --git a/Assets/Sounds/SpeedUp/SpeedUp03.mp3.meta b/Assets/Sounds/SpeedUp/SpeedUp03.mp3.meta new file mode 100644 index 0000000..a67194c --- /dev/null +++ b/Assets/Sounds/SpeedUp/SpeedUp03.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 4285bbaea081a6f4490fd8a485408977 +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Sounds/SpeedUp/SpeedUp04.mp3 b/Assets/Sounds/SpeedUp/SpeedUp04.mp3 new file mode 100644 index 0000000..c385cb4 Binary files /dev/null and b/Assets/Sounds/SpeedUp/SpeedUp04.mp3 differ diff --git a/Assets/Sounds/SpeedUp/SpeedUp04.mp3.meta b/Assets/Sounds/SpeedUp/SpeedUp04.mp3.meta new file mode 100644 index 0000000..0fc8f54 --- /dev/null +++ b/Assets/Sounds/SpeedUp/SpeedUp04.mp3.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: a9f86995a34d2594c8688021b82a4fbe +AudioImporter: + externalObjects: {} + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + ambisonic: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: