FiE-Game/Assets/Scripts/Fie/Enemies/HoovesRaces/Flightling/FieEmitObjectFlightlingConcentration.cs

71 lines
1.3 KiB
C#
Raw Normal View History

2018-11-20 20:10:49 +01:00
using Fie.Object;
using ParticlePlayground;
using System.Collections.Generic;
using UnityEngine;
namespace Fie.Enemies.HoovesRaces.Flightling
{
[FiePrefabInfo("Prefabs/Enemies/ChangelingForces/Flightling/Power/FlightlingConcentration")]
public class FieEmitObjectFlightlingConcentration : FieEmittableObjectBase
{
private const float EFFECT_DURATION = 1.5f;
private const float DURATION = 2.5f;
public List<PlaygroundParticlesC> effects;
public AudioSource soundEffect;
private float lifeTime;
private bool isStopEffects;
public override void awakeEmitObject()
{
foreach (PlaygroundParticlesC effect in effects)
{
if (effect != null)
{
effect.emit = true;
}
}
}
private void Update()
{
if (base.ownerCharacter == null)
{
lifeTime = 1.5f;
}
lifeTime += Time.deltaTime;
if (lifeTime > 1.5f && !isStopEffects && effects != null)
{
foreach (PlaygroundParticlesC effect in effects)
{
if (effect != null)
{
effect.emit = false;
}
}
if (soundEffect != null)
{
soundEffect.Stop();
}
isStopEffects = true;
}
if (lifeTime > 2.5f)
{
destoryEmitObject();
}
}
private void LateUpdate()
{
if (!(initTransform == null))
{
base.transform.position = initTransform.position;
}
}
}
}