Add Bringer of Death & Laser beam damages on stay
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -17,11 +18,18 @@ public class LaserBeam : MonoBehaviour
|
||||
{
|
||||
if (collision.CompareTag("Ennemy"))
|
||||
{
|
||||
collision.gameObject.GetComponent<Ennemy>().Life -= Damages;
|
||||
collision.gameObject.GetComponent<Ennemy>().AnimateHit();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTriggerStay2D(Collider2D collision)
|
||||
{
|
||||
if (collision.CompareTag("Ennemy"))
|
||||
{
|
||||
collision.gameObject.GetComponent<Ennemy>().Life -= (int)(Damages * Time.deltaTime);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator EndLifeAfterXSeconds()
|
||||
{
|
||||
yield return new WaitForSeconds(lifeSeconds);
|
||||
|
||||
Reference in New Issue
Block a user