Guest User

Untitled

a guest
May 8th, 2015
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Bullet : MonoBehaviour {
  5.    
  6.     public GameObject BulletObject;
  7.     public Rigidbody2D BulletBody;
  8.  
  9.     public float DestroyTime = .5f;
  10.  
  11.     public int Damage;
  12.  
  13.     void Start () {
  14.         BulletBody.AddForce (new Vector2(Vector3.right.x, Vector3.right.y) * 1000);
  15.         BulletObject.transform.position = GameObject.FindGameObjectWithTag ("PewThing").transform.position;
  16.  
  17.     }
  18.  
  19.     void Update () {
  20.         if (DestroyTime > 0f) {
  21.             DestroyTime -= Time.deltaTime;
  22.         } else {
  23.             Destroy (this.gameObject);
  24.         }
  25.  
  26.         transform.Rotate(new Vector3(Input.GetAxis("Mouse Y"), Input.GetAxis("Mouse X"), 0) * Time.deltaTime * 10);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment