Advertisement
Guest User

Ch0nG - Laser.cs

a guest
Aug 13th, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Laser : MonoBehaviour {
  5.  
  6.     private Transform TS;
  7.     public int Speed = 7;
  8.  
  9.     // Use this for initialization
  10.     void Start () {
  11.         TS = transform;
  12.     }
  13.    
  14.     // Update is called once per frame
  15.     void Update () {
  16.         //Space bar shoots the laser!
  17.             TS.Translate (Vector3.up * Speed * Time.deltaTime);
  18.  
  19.         if (TS.position.y>5.3) {
  20.             Object.Destroy(gameObject);
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement