FiE-Game/Assets/Scripts/Fie/Enemies/HoovesRaces/QueenChrysalis/FieEmitObjectQueenChrysalisHornEffect.cs

63 lines
1.2 KiB
C#
Raw Normal View History

2018-11-20 20:10:49 +01:00
using Fie.Object;
using ParticlePlayground;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.QueenChrysalis
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/QueenChrysalis/Power/QueenChrysalisHornEffect")]
public class FieEmitObjectQueenChrysalisHornEffect : FieEmittableObjectBase
{
[SerializeField]
private float HORN_EFFECT_MAXIMUM_DURATION = 10f;
[SerializeField]
private float HORN_EFFECT_DESTROY_DURATION = 1f;
[SerializeField]
private PlaygroundParticlesC _hornParticle;
private float _lifeCount;
private bool _isEnd;
public void Kill()
{
if (!_isEnd)
{
if (_hornParticle != null)
{
_hornParticle.emit = false;
}
destoryEmitObject(HORN_EFFECT_DESTROY_DURATION);
_isEnd = true;
}
}
public override void awakeEmitObject()
{
_hornParticle.emit = true;
}
private void Update()
{
if (!_isEnd)
{
_lifeCount += Time.deltaTime;
if (_lifeCount > HORN_EFFECT_MAXIMUM_DURATION)
{
Kill();
}
}
}
private void LateUpdate()
{
if (!(initTransform == null))
{
base.transform.position = initTransform.position;
base.transform.rotation = initTransform.rotation;
}
}
}
}