Add Unity materials and prefabs for game objects for SOLID
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Solid.Abstracts
|
||||
{
|
||||
public abstract class AreaOfEffect : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private ParticleSystem _particleSystem;
|
||||
[SerializeField] private AudioClip _audioClip;
|
||||
[SerializeField] private float _duration = 0.5f;
|
||||
|
||||
private void OnCollisionEnter(Collision other)
|
||||
{
|
||||
if (!IsInsideOfEffectArea(other.collider)) return;
|
||||
|
||||
_particleSystem.Play();
|
||||
AudioSource.PlayClipAtPoint(_audioClip, transform.position, _duration);
|
||||
|
||||
ApplyEffect();
|
||||
}
|
||||
|
||||
protected abstract bool IsInsideOfEffectArea(Collider other);
|
||||
|
||||
private void ApplyEffect()
|
||||
{
|
||||
// apply effect here
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 596149fd95654692bd453bd98ea669e5
|
||||
timeCreated: 1774973960
|
||||
Reference in New Issue
Block a user