mirror of
https://github.com/FriendshipIsEpic/FiE-Game.git
synced 2024-11-30 00:48:00 +01:00
61 lines
1.2 KiB
C#
61 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;
|
||
|
}
|
||
|
}
|
||
|
}
|