projectile and enemy collision. Iniitial player death state (teleport to start)
This commit is contained in:
@@ -8,6 +8,7 @@ public class Projectile : MonoBehaviour
|
||||
Vector3 oldEulerAngles;
|
||||
|
||||
public float damage;
|
||||
private string element = null;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
@@ -28,10 +29,14 @@ public class Projectile : MonoBehaviour
|
||||
private void OnCollisionEnter(Collision collision)
|
||||
{
|
||||
Debug.LogWarning(collision.gameObject.name);
|
||||
if (collision.gameObject.tag != "IceBolt" && collision.gameObject.tag != "Player" && !collided)
|
||||
GameObject obj = collision.gameObject;
|
||||
if (obj.tag != "IceBolt" && obj.tag != "Player" && !collided)
|
||||
{
|
||||
collided = true;
|
||||
if (collision.gameObject.name == "Dummy") Destroy(collision.gameObject); //REPLACE WITH ENEMY TAG CHECK AND DAMAGE CHECKING
|
||||
if (obj.CompareTag("Slime"))
|
||||
{
|
||||
obj.GetComponent<SlimeAI>().GetHit(Mathf.RoundToInt(damage));
|
||||
}
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user