initial upload
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class playerwalkingsound : MonoBehaviour
|
||||
{
|
||||
public AudioClip walkingsound;
|
||||
|
||||
public AnimationClip walkAnimation;
|
||||
|
||||
public virtual void Update()
|
||||
{
|
||||
Transform transform = GameObject.FindWithTag("Player").transform;
|
||||
GetComponent<AudioSource>().clip = walkingsound;
|
||||
GetComponent<AudioSource>().loop = true;
|
||||
if (Input.GetKeyDown(KeyCode.W))
|
||||
{
|
||||
GetComponent<AudioSource>().Play();
|
||||
GetComponent<AudioSource>().loop = true;
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.W))
|
||||
{
|
||||
GetComponent<AudioSource>().Stop();
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.S))
|
||||
{
|
||||
GetComponent<AudioSource>().Play();
|
||||
GetComponent<AudioSource>().loop = true;
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.S))
|
||||
{
|
||||
GetComponent<AudioSource>().Stop();
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.A))
|
||||
{
|
||||
GetComponent<AudioSource>().Play();
|
||||
GetComponent<AudioSource>().loop = true;
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.A))
|
||||
{
|
||||
GetComponent<AudioSource>().Stop();
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.D))
|
||||
{
|
||||
GetComponent<AudioSource>().Play();
|
||||
GetComponent<AudioSource>().loop = true;
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.D))
|
||||
{
|
||||
GetComponent<AudioSource>().Stop();
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.UpArrow))
|
||||
{
|
||||
GetComponent<AudioSource>().Play();
|
||||
GetComponent<AudioSource>().loop = true;
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.UpArrow))
|
||||
{
|
||||
GetComponent<AudioSource>().Stop();
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.DownArrow))
|
||||
{
|
||||
GetComponent<AudioSource>().Play();
|
||||
GetComponent<AudioSource>().loop = true;
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.DownArrow))
|
||||
{
|
||||
GetComponent<AudioSource>().Stop();
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.LeftArrow))
|
||||
{
|
||||
GetComponent<AudioSource>().Play();
|
||||
GetComponent<AudioSource>().loop = true;
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.LeftArrow))
|
||||
{
|
||||
GetComponent<AudioSource>().Stop();
|
||||
}
|
||||
if (Input.GetKeyDown(KeyCode.RightArrow))
|
||||
{
|
||||
GetComponent<AudioSource>().Play();
|
||||
GetComponent<AudioSource>().loop = true;
|
||||
}
|
||||
if (Input.GetKeyUp(KeyCode.RightArrow))
|
||||
{
|
||||
GetComponent<AudioSource>().Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Main()
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user