using Fie.Manager; using Fie.Object; using ParticlePlayground; using System.Collections; using System.Collections.Generic; using UnityEngine; namespace Fie.Ponies.RisingSun { [FiePrefabInfo("Prefabs/RisingSun/Power/RisingSunForceField")] public class FieEmitObjectRisingSunForceField : FieEmittableObjectBase { [SerializeField] private float ForceFieldSeedDuration = 4f; [SerializeField] private float ForceFieldSeedDestroyDuration = 1f; [SerializeField] private float entytyInstantiateDelay = 0.3f; [SerializeField] private List _childParticles = new List(); private float _lifeTimeCount; private bool _isEndUpdate; private IEnumerator EmitSphereCoroutine() { yield return (object)new WaitForSeconds(entytyInstantiateDelay); /*Error: Unable to find new state assignment for yield return*/; } public override void awakeEmitObject() { _childParticles.ForEach(delegate(PlaygroundParticlesC particle) { particle.Emit(setEmission: true); }); } public void Update() { base.transform.localRotation = Quaternion.identity; if (!_isEndUpdate) { _lifeTimeCount += Time.deltaTime; if (_lifeTimeCount >= ForceFieldSeedDuration - ForceFieldSeedDestroyDuration) { stopParticleEmitting(); destoryEmitObject(ForceFieldSeedDestroyDuration); _isEndUpdate = true; } } } private void OnCollisionEnter(Collision collision) { if (!_isEndUpdate && !(_lifeTimeCount > ForceFieldSeedDuration - ForceFieldSeedDestroyDuration) && collision.gameObject.tag == "Floor") { emitForceFieldEntity(); stopParticleEmitting(); destoryEmitObject(ForceFieldSeedDestroyDuration); _isEndUpdate = true; } } private void stopParticleEmitting() { _childParticles.ForEach(delegate(PlaygroundParticlesC particle) { particle.Emit(setEmission: false); }); } private void emitForceFieldEntity() { Transform targetTransform = null; FieManagerBehaviour.I.EmitObject(base.transform, Vector3.zero, targetTransform, base.ownerCharacter); StartCoroutine(EmitSphereCoroutine()); } } }