Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Racet : MonoBehaviour
- {
- float countshoot2;
- Rigidbody racet;
- // Start is called before the first frame update
- void Start()
- {
- racet = GetComponent<Rigidbody>();
- // GetComponent<Rigidbody>().velocity = new Vector3(0, 0, 20);
- }
- void Update()
- {
- racet = GetComponent<Rigidbody>();
- GetComponent<Rigidbody>().velocity = new Vector3(0, 0, -30);
- }
- void OnTriggerEnter(Collider other)
- {
- countshoot2++;
- print(countshoot2);
- if (countshoot2 > 3)
- {
- countshoot2 = 0;
- if (other.tag == "shiptrig")
- Destroy(other.gameObject);
- Destroy(gameObject);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment