add sound to platform and repair deleting and edit jump and move

This commit is contained in:
haitem 2022-01-30 03:17:17 +01:00
parent dbe10318e1
commit 6f71f6225e
35 changed files with 723 additions and 37 deletions

View File

@ -1606,7 +1606,7 @@ Rigidbody:
m_IsKinematic: 0 m_IsKinematic: 0
m_Interpolate: 0 m_Interpolate: 0
m_Constraints: 112 m_Constraints: 112
m_CollisionDetection: 2 m_CollisionDetection: 1
--- !u!114 &3244356566819001086 --- !u!114 &3244356566819001086
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -98,6 +98,7 @@ GameObject:
- component: {fileID: 1430690303722568316} - component: {fileID: 1430690303722568316}
- component: {fileID: 8238111678033492397} - component: {fileID: 8238111678033492397}
- component: {fileID: -5509448037057392871} - component: {fileID: -5509448037057392871}
- component: {fileID: 2527761051471871889}
m_Layer: 0 m_Layer: 0
m_Name: Platform_Blue m_Name: Platform_Blue
m_TagString: platform m_TagString: platform
@ -201,6 +202,11 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 2 type: 2
speed: 20 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 --- !u!65 &8238111678033492397
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -208,7 +214,7 @@ BoxCollider:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8768991388683709947} m_GameObject: {fileID: 8768991388683709947}
m_Material: {fileID: 13400000, guid: 055b414bc685d41409a41f4ea2d64231, type: 2} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
@ -226,3 +232,99 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 61dae18984b7ff147ab1d77fb817687a, type: 3} m_Script: {fileID: 11500000, guid: 61dae18984b7ff147ab1d77fb817687a, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: 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

View File

@ -202,6 +202,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 0 type: 0
speed: 5 speed: 5
audioSource: {fileID: 0}
audioClips: []
--- !u!65 &3865253352867341094 --- !u!65 &3865253352867341094
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -209,7 +211,7 @@ BoxCollider:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8768991388683709947} m_GameObject: {fileID: 8768991388683709947}
m_Material: {fileID: 13400000, guid: 055b414bc685d41409a41f4ea2d64231, type: 2} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2

View File

@ -114,6 +114,7 @@ GameObject:
- component: {fileID: 1183598848765291555} - component: {fileID: 1183598848765291555}
- component: {fileID: 6218203028538785626} - component: {fileID: 6218203028538785626}
- component: {fileID: 1204402889283165505} - component: {fileID: 1204402889283165505}
- component: {fileID: 7973800414101489524}
m_Layer: 0 m_Layer: 0
m_Name: Platform_Orange m_Name: Platform_Orange
m_TagString: platform m_TagString: platform
@ -201,6 +202,12 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 6 type: 6
speed: 10 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 --- !u!65 &6218203028538785626
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -208,7 +215,7 @@ BoxCollider:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6650340373999088090} m_GameObject: {fileID: 6650340373999088090}
m_Material: {fileID: 13400000, guid: 055b414bc685d41409a41f4ea2d64231, type: 2} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
@ -226,3 +233,99 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 61dae18984b7ff147ab1d77fb817687a, type: 3} m_Script: {fileID: 11500000, guid: 61dae18984b7ff147ab1d77fb817687a, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: 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

View File

@ -114,6 +114,7 @@ GameObject:
- component: {fileID: 3861707493128515586} - component: {fileID: 3861707493128515586}
- component: {fileID: 5316890779910729157} - component: {fileID: 5316890779910729157}
- component: {fileID: -142748814437030588} - component: {fileID: -142748814437030588}
- component: {fileID: 5862113707430629064}
m_Layer: 0 m_Layer: 0
m_Name: Platform_Red m_Name: Platform_Red
m_TagString: platform m_TagString: platform
@ -200,7 +201,12 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 1 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 --- !u!65 &5316890779910729157
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -208,7 +214,7 @@ BoxCollider:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8768991388683709947} m_GameObject: {fileID: 8768991388683709947}
m_Material: {fileID: 13400000, guid: 055b414bc685d41409a41f4ea2d64231, type: 2} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
@ -226,3 +232,99 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 61dae18984b7ff147ab1d77fb817687a, type: 3} m_Script: {fileID: 11500000, guid: 61dae18984b7ff147ab1d77fb817687a, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: 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

View File

@ -114,6 +114,7 @@ GameObject:
- component: {fileID: 7821003709828495146} - component: {fileID: 7821003709828495146}
- component: {fileID: 4344779564172896453} - component: {fileID: 4344779564172896453}
- component: {fileID: 5433657018731068073} - component: {fileID: 5433657018731068073}
- component: {fileID: 8383421295717427161}
m_Layer: 0 m_Layer: 0
m_Name: Platform_yellow m_Name: Platform_yellow
m_TagString: platform m_TagString: platform
@ -201,6 +202,12 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 5 type: 5
speed: 10 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 --- !u!65 &4344779564172896453
BoxCollider: BoxCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -208,7 +215,7 @@ BoxCollider:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8768991388683709947} m_GameObject: {fileID: 8768991388683709947}
m_Material: {fileID: 13400000, guid: 055b414bc685d41409a41f4ea2d64231, type: 2} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
@ -226,3 +233,99 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 61dae18984b7ff147ab1d77fb817687a, type: 3} m_Script: {fileID: 11500000, guid: 61dae18984b7ff147ab1d77fb817687a, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: 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

View File

@ -177,7 +177,7 @@ BoxCollider:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7678802340880963262} m_GameObject: {fileID: 7678802340880963262}
m_Material: {fileID: 13400000, guid: 055b414bc685d41409a41f4ea2d64231, type: 2} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
@ -197,6 +197,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
type: 0 type: 0
speed: 5 speed: 5
audioSource: {fileID: 0}
audioClips: []
--- !u!114 &-731181381576803345 --- !u!114 &-731181381576803345
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -7,6 +7,8 @@ public class PlatformManager : MonoBehaviour
public enum PlatformType {Basic, Pull, Push, RotateZ, RotateY, SpeedUp, SpeedDown}; public enum PlatformType {Basic, Pull, Push, RotateZ, RotateY, SpeedUp, SpeedDown};
public PlatformType type = PlatformType.Pull; public PlatformType type = PlatformType.Pull;
public float speed = 5; public float speed = 5;
public AudioSource audioSource;
public List<AudioClip> audioClips = new List<AudioClip>();
void FixedUpdate() void FixedUpdate()
{ {
@ -17,4 +19,12 @@ public class PlatformManager : MonoBehaviour
transform.Rotate(transform.up * speed * Time.deltaTime); 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)]);
}
}
} }

View File

@ -85,7 +85,7 @@ public class PlayerController : MonoBehaviour
} }
float curSpeedX = canMove ? (currentSpeed + speedModifier) : 0; 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); 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 (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]) { if (audioClips.Count > 1 && audioSource.clip != audioClips[1]) {
audioSource.Stop(); audioSource.Stop();
@ -118,7 +118,7 @@ public class PlayerController : MonoBehaviour
audioSource.clip = audioClips[0]; audioSource.clip = audioClips[0];
audioSource.Play(); audioSource.Play();
} }
} else if ((currentSpeed + speedModifier) >= speed * 7f) { } else if ((currentSpeed + speedModifier) >= speed * 6f) {
if (audioClips.Count > 2 && audioSource.clip != audioClips[2]) if (audioClips.Count > 2 && audioSource.clip != audioClips[2])
{ {
audioSource.Stop(); audioSource.Stop();
@ -136,7 +136,7 @@ public class PlayerController : MonoBehaviour
if (inAir) if (inAir)
{ {
// Debug.Log("Jump"); // 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; inAir = false;
} }
@ -219,10 +219,10 @@ public class PlayerController : MonoBehaviour
if (other.GetContact(0).normal == other.transform.forward if (other.GetContact(0).normal == other.transform.forward
|| 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.up && other.GetContact(0).normal != other.transform.up)
&& other.GetContact(0).normal != other.transform.right
&& other.GetContact(0).normal != -other.transform.right)
) )
{ {
return; return;
@ -240,24 +240,10 @@ public class PlayerController : MonoBehaviour
isGrounded = true; isGrounded = true;
if (other.gameObject.tag == "platform") 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<PlatformManager>(); PlatformManager platform = other.gameObject.GetComponent<PlatformManager>();
if (platform != null) if (platform != null)
{ {
platform.Step();
switch (platform.type) switch (platform.type)
{ {
case PlatformManager.PlatformType.Push: case PlatformManager.PlatformType.Push:
@ -285,14 +271,24 @@ public class PlayerController : MonoBehaviour
speedModifier = 0.0f; speedModifier = 0.0f;
} }
break; 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; platformForward = other.transform.forward;
this.downDirection = gDirection; this.downDirection = gDirection;

View File

@ -47,7 +47,7 @@ public class ProceduralGeneration : MonoBehaviour
List<GameObject> spawnSpiralOfPlatforms(GameObject lastObject, GameObject objToSpawn, GameObject parentLevelObject) List<GameObject> spawnSpiralOfPlatforms(GameObject lastObject, GameObject objToSpawn, GameObject parentLevelObject)
{ {
// configuration: // configuration:
float horizontalDistancePerPlatform = (float)Random.Range(0.5f, 2.0f); float horizontalDistancePerPlatform = (float)Random.Range(1.0f, 3.0f);
List<GameObject> levelBlocksSpawnTemp = new List<GameObject>(); List<GameObject> levelBlocksSpawnTemp = new List<GameObject>();
// Debug.Log("Building LOOP"); // Debug.Log("Building LOOP");
@ -102,7 +102,7 @@ public class ProceduralGeneration : MonoBehaviour
for (var i = 0; i < this.spawnedLevelBlocks.Count; i++) for (var i = 0; i < this.spawnedLevelBlocks.Count; i++)
{ {
float distance = Vector3.Distance(this.spawnedLevelBlocks[i].transform.position, playerPosition); 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]); Destroy(this.spawnedLevelBlocks[i]);
this.spawnedLevelBlocks.Remove(this.spawnedLevelBlocks[i]); this.spawnedLevelBlocks.Remove(this.spawnedLevelBlocks[i]);

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6f7627d76e56c724b978e5b6e15a6e6d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -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:

Binary file not shown.

View File

@ -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:

Binary file not shown.

View File

@ -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:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bc9bdfba777b8fe459f8df308f1abf8b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -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:

Binary file not shown.

View File

@ -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:

Binary file not shown.

View File

@ -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:

Binary file not shown.

View File

@ -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:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8f252e5f5885a5f49bb259dedb2fe565
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -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:

Binary file not shown.

View File

@ -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:

Binary file not shown.

View File

@ -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:

Binary file not shown.

View File

@ -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: