Created
March 19, 2021 14:19
-
-
Save ZeroCool5254/c684260ea52a4130fc03804b3cb9f36a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Laser : MonoBehaviour | |
{ | |
[SerializeField] | |
private float _speed = 8.0f; | |
void Update() | |
{ | |
transform.Translate(Vector3.up * _speed * Time.deltaTime); | |
if (transform.position.y >= 7) | |
{ | |
Destroy(this.gameObject); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment