using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; public class SpaceshipBot : MonoBehaviour { [SerializeField]private float movingSpeed; [SerializeField]private float TurningSmoothness; [SerializeField]private Transform body; public UnityEvent OnDie; void FixedUpdate() { // body.Translate(body.up * movingSpeed); body.Translate(new Vector3(0, movingSpeed), body); } public void Die(){ OnDie.Invoke(); Destroy(gameObject); } public void TrailCollided(Collider2D hit){ // Debug.Log($"I got hit with this : {hit.name}"); if(hit.GetComponent()!=null){ hit.GetComponent().Die(); } } }