Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Laser : MonoBehaviour {
- private Transform TS;
- public int wspeed = 8;
- void Start() {
- TS = transform;
- }
- // Update is called once per frame
- void Update () {
- TS.Translate (Vector3.up * wspeed * Time.deltaTime);
- if (TS.position.y > 7.5) {
- Destroy (this.gameObject);
- }
- }
- void OnTriggerEnter(Collider collider)
- {
- if (collider.CompareTag("Enemy")) {
- Destroy(this.gameObject);
- Player.score += 50;
- print(Player.score);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement