the scarlet police have me at gun point
This commit is contained in:
parent
b964c9b617
commit
d6da52fd69
54 changed files with 674 additions and 55 deletions
26
Assets/Scripts/Effects/Effect.cs
Normal file
26
Assets/Scripts/Effects/Effect.cs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class Effect : ScriptableObject
|
||||
{
|
||||
[SerializeField] private EffectInstance effectInstanceObject;
|
||||
[Header("Stats")]
|
||||
public float duration;
|
||||
public bool isConstant; //that means if it uses the tick function or not
|
||||
|
||||
public virtual void ApplyEffect(Entity affectedEntity)
|
||||
{
|
||||
EffectInstance newEffectInstance = Instantiate(effectInstanceObject, affectedEntity.transform);
|
||||
newEffectInstance.affectedEntity = affectedEntity;
|
||||
|
||||
}
|
||||
|
||||
public virtual void EffectTick(Entity affectedEntity)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public virtual void RemoveEffect(Entity affectedEntity)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Effects/Effect.cs.meta
Normal file
2
Assets/Scripts/Effects/Effect.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c83f7c791d22a8317bdf4351fbcd97a0
|
||||
22
Assets/Scripts/Effects/EffectInstance.cs
Normal file
22
Assets/Scripts/Effects/EffectInstance.cs
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class EffectInstance : MonoBehaviour
|
||||
{
|
||||
public Effect thisEffect;
|
||||
public Entity affectedEntity;
|
||||
public float timeElapsed;
|
||||
private void Update()
|
||||
{
|
||||
timeElapsed += Time.deltaTime;
|
||||
if (timeElapsed > thisEffect.duration)
|
||||
{
|
||||
thisEffect.RemoveEffect(affectedEntity);
|
||||
return;
|
||||
}
|
||||
if (thisEffect.isConstant)
|
||||
{
|
||||
thisEffect.EffectTick(affectedEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Effects/EffectInstance.cs.meta
Normal file
2
Assets/Scripts/Effects/EffectInstance.cs.meta
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d9461c5d5a30726ac8395e724c006d73
|
||||
Loading…
Add table
Add a link
Reference in a new issue