Compare commits

..

No commits in common. "18a2f9944dce81a98d00f3fef01f8aad344d61a4" and "aed80e1e8551dcdb4cb6574f16a8cbca94b36947" have entirely different histories.

2 changed files with 4 additions and 14 deletions

View File

@ -22,15 +22,13 @@ public class AudioManager : MonoBehaviour
} }
// Update is called once per frame // Update is called once per frame
public void Play(string name, bool checkIfPlay = false) public void Play(string name)
{ {
AudioSound s = Array.Find(clips, sound => sound.name == name); AudioSound s = Array.Find(clips, sound => sound.name == name);
if (s == null) { if (s == null) {
return; return;
} }
Debug.Log("Sound is playng"); Debug.Log("Sound is playng");
if (!s.source.isPlaying || !checkIfPlay) { s.source.Play();
s.source.Play();
}
} }
} }

View File

@ -249,6 +249,7 @@ public class PlayerManager : MonoBehaviour
if (Input.GetAxis("Horizontal") > 0) if (Input.GetAxis("Horizontal") > 0)
{ {
playerAnimator.SetBool("Walk", true); playerAnimator.SetBool("Walk", true);
FindObjectOfType<AudioManager>().Play("Walk");
if (pushPullObject == null) { if (pushPullObject == null) {
playerAnimator.transform.rotation = Quaternion.Lerp( playerAnimator.transform.rotation = Quaternion.Lerp(
playerAnimator.transform.rotation, playerAnimator.transform.rotation,
@ -260,6 +261,7 @@ public class PlayerManager : MonoBehaviour
else if (Input.GetAxis("Horizontal") < 0) else if (Input.GetAxis("Horizontal") < 0)
{ {
playerAnimator.SetBool("Walk", true); playerAnimator.SetBool("Walk", true);
FindObjectOfType<AudioManager>().Play("Walk");
if (pushPullObject == null) if (pushPullObject == null)
{ {
playerAnimator.transform.rotation = Quaternion.Lerp( playerAnimator.transform.rotation = Quaternion.Lerp(
@ -277,16 +279,6 @@ public class PlayerManager : MonoBehaviour
void Move() void Move()
{ {
if (Input.GetAxis("Horizontal") != 0)
{
if (!run) {
FindObjectOfType<AudioManager>().Play("Walk", true);
}
else
{
FindObjectOfType<AudioManager>().Play("Run", true);
}
}
rigidBody.MovePosition( rigidBody.MovePosition(
transform.position + transform.position +
(onLadder && activeAbility.Count > 0 && activeAbility[0] == 4 ? (transform.up * speed * Input.GetAxis("Vertical") * Time.deltaTime) : Vector3.zero) + (onLadder && activeAbility.Count > 0 && activeAbility[0] == 4 ? (transform.up * speed * Input.GetAxis("Vertical") * Time.deltaTime) : Vector3.zero) +