Destroy gun when out of view
This commit is contained in:
@@ -13,5 +13,9 @@ public class Gun : MonoBehaviour
|
|||||||
|
|
||||||
void Update() {
|
void Update() {
|
||||||
transform.Rotate(new Vector3 (0, 0, Time.deltaTime * 1000));
|
transform.Rotate(new Vector3 (0, 0, Time.deltaTime * 1000));
|
||||||
|
if (Vector3.Distance(
|
||||||
|
transform.position,
|
||||||
|
GameObject.FindGameObjectWithTag("Player").transform.position
|
||||||
|
) > 20) Destroy(gameObject);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user