Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class InputAccelerometro : MonoBehaviour {
- public float speed;
- public GameObject shot;
- public Transform shotSpawn;
- public float fireRate;
- private float nextFire;
- private AudioSource playerAudio;
- // Use this for initialization
- void Start () {
- }
- // Update is called once per frame
- void Update () {
- if (Input.GetMouseButton (0) && Time.time > nextFire) {
- nextFire = Time.time + fireRate;
- Instantiate (shot, shotSpawn.position, shotSpawn.rotation);
- playerAudio.Play ();
- }
- transform.Translate(0.0f,speed * Input.acceleration.y,speed * -Input.acceleration.z);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement