Some sound edit
This commit is contained in:
parent
93e4d21108
commit
2dbeaa26b4
@ -22,13 +22,15 @@ public class AudioManager : MonoBehaviour
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
public void Play(string name)
|
||||
public void Play(string name, bool checkIfPlay = false)
|
||||
{
|
||||
AudioSound s = Array.Find(clips, sound => sound.name == name);
|
||||
if (s == null) {
|
||||
return;
|
||||
}
|
||||
Debug.Log("Sound is playng");
|
||||
s.source.Play();
|
||||
if (!s.source.isPlaying || !checkIfPlay) {
|
||||
s.source.Play();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -249,7 +249,6 @@ public class PlayerManager : MonoBehaviour
|
||||
if (Input.GetAxis("Horizontal") > 0)
|
||||
{
|
||||
playerAnimator.SetBool("Walk", true);
|
||||
FindObjectOfType<AudioManager>().Play("Walk");
|
||||
if (pushPullObject == null) {
|
||||
playerAnimator.transform.rotation = Quaternion.Lerp(
|
||||
playerAnimator.transform.rotation,
|
||||
@ -261,7 +260,6 @@ public class PlayerManager : MonoBehaviour
|
||||
else if (Input.GetAxis("Horizontal") < 0)
|
||||
{
|
||||
playerAnimator.SetBool("Walk", true);
|
||||
FindObjectOfType<AudioManager>().Play("Walk");
|
||||
if (pushPullObject == null)
|
||||
{
|
||||
playerAnimator.transform.rotation = Quaternion.Lerp(
|
||||
@ -279,6 +277,16 @@ public class PlayerManager : MonoBehaviour
|
||||
|
||||
void Move()
|
||||
{
|
||||
if (Input.GetAxis("Horizontal") != 0)
|
||||
{
|
||||
if (!run) {
|
||||
FindObjectOfType<AudioManager>().Play("Walk", true);
|
||||
}
|
||||
else
|
||||
{
|
||||
FindObjectOfType<AudioManager>().Play("Run", true);
|
||||
}
|
||||
}
|
||||
rigidBody.MovePosition(
|
||||
transform.position +
|
||||
(onLadder && activeAbility.Count > 0 && activeAbility[0] == 4 ? (transform.up * speed * Input.GetAxis("Vertical") * Time.deltaTime) : Vector3.zero) +
|
||||
|
Loading…
Reference in New Issue
Block a user