26 lines
574 B
C#
26 lines
574 B
C#
using UnityEngine;
|
|
|
|
public class PoisonPool : MonoBehaviour
|
|
{
|
|
public float damagePerSecond = 8f;
|
|
public float lifeTime = 6f;
|
|
|
|
private void Start()
|
|
{
|
|
Destroy(gameObject, lifeTime);
|
|
}
|
|
|
|
public void SetDamage(float damage,float dieTime)
|
|
{
|
|
damagePerSecond = damage;
|
|
lifeTime = dieTime;
|
|
}
|
|
|
|
private void OnTriggerStay(Collider other)
|
|
{
|
|
if (!other.CompareTag("Player")) return;
|
|
|
|
other.GetComponent<EnemyIDamagable>()
|
|
?.ApplyDamage(damagePerSecond * Time.deltaTime, null, transform);
|
|
}
|
|
} |