Hi,im making one serious thing in my fps game,anyway i have physics controller which i can controll game object: Ball
Well i need to make it jump and play sounds when ball start to jump (jumps up) and sound when is landed. And also when moving ball. (Footsteps)
Lol, i know it sounds easy,but i cant do that :((
Need sound when ball is moving (like footsteps) When starting jump-jumps up (Plays jump sound) and when is landed (Plays landing sound) Just like fps player controller sounds (In movement or action :D)
Please help me at this,im in real problem now,i cannot do anything further without it.
Please Please help me at this.
using UnityEngine;
using System.Collections;
public class PlayerControl : MonoBehaviour
{
private GameObject _GameManager;
public Vector3 movement;
public float moveSpeed = 6.0f;
public float drag = 2;
void Start()
{
_GameManager = GameObject.Find("_GameManager");
}
void Update ()
{
Vector3 forward = Camera.main.transform.TransformDirection(Vector3.forward);
forward.y = 0;
forward = forward.normalized;
Vector3 forwardForce = forward * Input.GetAxis("Vertical") * moveSpeed;
rigidbody.AddForce(forwardForce);
Vector3 right= Camera.main.transform.TransformDirection(Vector3.right);
right.y = 0;
right = right.normalized;
Vector3 rightForce= right * Input.GetAxis("Horizontal") * moveSpeed;
rigidbody.AddForce(rightForce);
}
void OnTriggerEnter (Collider other )
{
if (other.tag == "Destroy")
{
_GameManager.GetComponent<GameManager>().Death();
Destroy(gameObject);
}
else if (other.tag == "Coin")
{
Destroy(other.gameObject);
_GameManager.GetComponent<GameManager>().FoundCoin();
}
else if (other.tag == "SpeedBooster")
{
movement = new Vector3(0,0,0);
_GameManager.GetComponent<GameManager>().SpeedBooster();
}
else if (other.tag == "JumpBooster")
{
movement = new Vector3(0,0,0);
_GameManager.GetComponent<GameManager>().JumpBooster();
}
else if (other.tag == "Teleporter")
{
movement = new Vector3(0,0,0);
_GameManager.GetComponent<GameManager>().Teleporter();
}
}
}