using System.Collections; using System.Collections.Generic; using UnityEngine; public class Bullet : MonoBehaviour { public float speed = 8f; private Rigidbody bulletRigidbody; void Start() { bulletRigidbody = GetComponent(); bulletRigidbody.linearVelocity = transform.forward * speed; Destroy(gameObject, 3f); } void OnTriggerEnter(Collider other) { if(other.tag == "Player") { PlayerController playerController = other.GetComponent(); if(playerController != null ) { playerController.Die(); } } } void Update() { } }