30 lines
782 B
C#
30 lines
782 B
C#
using UnityEngine;
|
|
|
|
namespace DefaultNamespace.Solid
|
|
{
|
|
public abstract class AreaOfEffect : MonoBehaviour
|
|
{
|
|
[SerializeField] private ParticleSystem _particleSystem;
|
|
[SerializeField] private AudioClip _audioClip;
|
|
[SerializeField] private float _duration;
|
|
|
|
private AudioSource _audioSource;
|
|
|
|
protected abstract bool IsInsideOfEffectArea(Collision other);
|
|
|
|
private void OnCollisionEnter(Collision other)
|
|
{
|
|
if (!IsInsideOfEffectArea(other)) return;
|
|
|
|
_particleSystem.Play();
|
|
_audioSource.PlayOneShot(_audioClip);
|
|
|
|
ApplyEffect();
|
|
}
|
|
|
|
private void ApplyEffect()
|
|
{
|
|
// apply effect to something
|
|
}
|
|
}
|
|
} |