Advertisement
Guest User

Untitled

a guest
Sep 2nd, 2015
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class InputAccelerometro : MonoBehaviour {
  5. public float speed;
  6. public GameObject shot;
  7. public Transform shotSpawn;
  8. public float fireRate;
  9. private float nextFire;
  10. private AudioSource playerAudio;
  11. // Use this for initialization
  12. void Start () {
  13.  
  14. }
  15.  
  16. // Update is called once per frame
  17. void Update () {
  18. if (Input.GetMouseButton (0) && Time.time > nextFire) {
  19. nextFire = Time.time + fireRate;
  20. Instantiate (shot, shotSpawn.position, shotSpawn.rotation);
  21. playerAudio.Play ();
  22. }
  23. transform.Translate(0.0f,speed * Input.acceleration.y,speed * -Input.acceleration.z);
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement