mirror of
https://github.com/FriendshipIsEpic/FiE-Game.git
synced 2024-11-23 14:17:59 +01:00
60 lines
1.2 KiB
C#
60 lines
1.2 KiB
C#
using Fie.Object;
|
|
using ParticlePlayground;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace Fie.Ponies.Twilight
|
|
{
|
|
[FiePrefabInfo("Prefabs/Twilight/Power/TwilightLaserDust")]
|
|
public class FieEmitObjectTwilightLaserDust : FieEmittableObjectBase
|
|
{
|
|
[SerializeField]
|
|
private float DustDuration = 3f;
|
|
|
|
[SerializeField]
|
|
private float DustEmitDuration = 1.8f;
|
|
|
|
[SerializeField]
|
|
private List<PlaygroundParticlesC> _childParticles = new List<PlaygroundParticlesC>();
|
|
|
|
private float _lifeTime;
|
|
|
|
private bool _isEndUpdate;
|
|
|
|
public void setDuration(float duration)
|
|
{
|
|
DustEmitDuration = duration;
|
|
}
|
|
|
|
public override void awakeEmitObject()
|
|
{
|
|
foreach (PlaygroundParticlesC childParticle in _childParticles)
|
|
{
|
|
childParticle.Emit(setEmission: true);
|
|
}
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!_isEndUpdate)
|
|
{
|
|
base.transform.position = initTransform.position;
|
|
_lifeTime += Time.deltaTime;
|
|
if (_lifeTime > DustEmitDuration)
|
|
{
|
|
foreach (PlaygroundParticlesC childParticle in _childParticles)
|
|
{
|
|
childParticle.Emit(setEmission: false);
|
|
}
|
|
_isEndUpdate = true;
|
|
destoryEmitObject(DustDuration - _lifeTime);
|
|
}
|
|
}
|
|
}
|
|
|
|
internal void Stop()
|
|
{
|
|
_lifeTime = DustEmitDuration;
|
|
}
|
|
}
|
|
}
|