unity-abgabe2/Assets/Projectile.cs

20 lines
390 B
C#
Raw Normal View History

2021-04-25 14:20:23 +00:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Projectile : MonoBehaviour
{
void Start()
{
}
public void OnCollisionEnter(Collision collision){
var bot = collision.collider?.transform.root.GetComponent<Bot>();
if(bot != null){
bot.hit();
}
Destroy(this.gameObject);
}
}