Jump/land SFX

This commit is contained in:
Yann Dupont 01 2022-04-03 18:07:43 -04:00
parent 6c5cb5a659
commit 4a4c95d302
2 changed files with 153 additions and 1 deletions

View File

@ -58,6 +58,13 @@ MonoBehaviour:
gameFlowManager: {fileID: 0} gameFlowManager: {fileID: 0}
stats: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2} stats: {fileID: 11400000, guid: 12a626b5a296d934ba078d222ad6ba98, type: 2}
globalCamera: {fileID: 0} globalCamera: {fileID: 0}
jumpSource: {fileID: 7164870411903264125}
jumpSounds:
- {fileID: 8300000, guid: 2f93dc5371f10744ba49e29576e8a6a7, type: 3}
landSource: {fileID: 5290033541484811060}
landSounds:
- {fileID: 8300000, guid: 1376bbb24def5184393e893817fe41ca, type: 3}
soundManager: {fileID: 0}
--- !u!114 &3126145803593047825 --- !u!114 &3126145803593047825
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -409,6 +416,8 @@ Transform:
- {fileID: 8766613565529140840} - {fileID: 8766613565529140840}
- {fileID: 6919064404994049919} - {fileID: 6919064404994049919}
- {fileID: 7801168753088406092} - {fileID: 7801168753088406092}
- {fileID: 4502282848150149069}
- {fileID: 1476073137437876612}
m_Father: {fileID: 1214567908930553594} m_Father: {fileID: 1214567908930553594}
m_RootOrder: 4 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -709,6 +718,73 @@ SpriteRenderer:
m_WasSpriteAssigned: 1 m_WasSpriteAssigned: 1
m_MaskInteraction: 0 m_MaskInteraction: 0
m_SpriteSortPoint: 0 m_SpriteSortPoint: 0
--- !u!1001 &1478865402374041860
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 903222670005920393}
m_Modifications:
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_RootOrder
value: 5
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6915619910278317271, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_Name
value: Land Source
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
--- !u!4 &1476073137437876612 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
m_PrefabInstance: {fileID: 1478865402374041860}
m_PrefabAsset: {fileID: 0}
--- !u!82 &5290033541484811060 stripped
AudioSource:
m_CorrespondingSourceObject: {fileID: 6767790137851257392, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
m_PrefabInstance: {fileID: 1478865402374041860}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &3643467873725871148 --- !u!1001 &3643467873725871148
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -776,6 +852,73 @@ AudioSource:
m_CorrespondingSourceObject: {fileID: 6767790137851257392, guid: 8929857cf558a9b40a30682dc94048ad, type: 3} m_CorrespondingSourceObject: {fileID: 6767790137851257392, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
m_PrefabInstance: {fileID: 3643467873725871148} m_PrefabInstance: {fileID: 3643467873725871148}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1001 &4504372482479179597
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 903222670005920393}
m_Modifications:
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_RootOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6915619910278317271, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
propertyPath: m_Name
value: Jump Source
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
--- !u!82 &7164870411903264125 stripped
AudioSource:
m_CorrespondingSourceObject: {fileID: 6767790137851257392, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
m_PrefabInstance: {fileID: 4504372482479179597}
m_PrefabAsset: {fileID: 0}
--- !u!4 &4502282848150149069 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 70347360213241984, guid: 8929857cf558a9b40a30682dc94048ad, type: 3}
m_PrefabInstance: {fileID: 4504372482479179597}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &6988628843130902527 --- !u!1001 &6988628843130902527
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -22,6 +22,12 @@ public class PlayerMovement : MonoBehaviour {
Animator animator = null!; Animator animator = null!;
public bool facingRight { get; private set; } = true; public bool facingRight { get; private set; } = true;
[SerializeField] AudioSource jumpSource;
[SerializeField] AudioClip[] jumpSounds;
[SerializeField] AudioSource landSource;
[SerializeField] AudioClip[] landSounds;
[HideInInspector] public SoundManager soundManager;
bool lastJumpButton; bool lastJumpButton;
public bool IsInSafeZone => currentState is ImmobileMovementState; public bool IsInSafeZone => currentState is ImmobileMovementState;
@ -33,6 +39,7 @@ public class PlayerMovement : MonoBehaviour {
vampireEntity = GetComponent<VampireEntity>(); vampireEntity = GetComponent<VampireEntity>();
animator = GetComponentInChildren<Animator>(); animator = GetComponentInChildren<Animator>();
currentState = new ImmobileMovementState(this); currentState = new ImmobileMovementState(this);
soundManager = FindObjectOfType<SoundManager>();
} }
void Start() { void Start() {
@ -185,10 +192,12 @@ public class PlayerMovement : MonoBehaviour {
startTime = Time.time; startTime = Time.time;
// playerMovement.animator.SetBool("Jumping", true); // playerMovement.animator.SetBool("Jumping", true);
playerMovement.animator.Play("Player_Jump"); playerMovement.animator.Play("Player_Jump");
playerMovement.soundManager.PlaySound(playerMovement.jumpSource, playerMovement.jumpSounds, randomPitch: true, createTempSourceIfBusy: true);
} }
public override void LeaveState() { public override void LeaveState() {
// playerMovement.animator.SetBool("Jumping", false); // playerMovement.animator.SetBool("Jumping", false);
playerMovement.animator.Play("Player_Idle"); playerMovement.animator.Play("Player_Idle");
playerMovement.soundManager.PlaySound(playerMovement.landSource, playerMovement.landSounds, randomPitch: true, createTempSourceIfBusy: true);
} }
public override BaseState? FixedUpdateState() { public override BaseState? FixedUpdateState() {
@ -236,7 +245,7 @@ public class PlayerMovement : MonoBehaviour {
} }
public override void LeaveState() { public override void LeaveState() {
base.EnterState(); base.LeaveState();
playerMovement.rb.SetEnabled(true); playerMovement.rb.SetEnabled(true);
} }