// Remove particle after any delay public void Remove(float Delay) { // Stop particle system if (m_ParticleSystem != null) { m_ParticleSystem.loop = false; m_ParticleSystem.Stop(); } // Update delay time m_RemoveDelay = Delay; // Destroy m_ParticleGameObject with FCGameObjectUtil if (m_RemoveDelay > 0) { // Attach FCGameObjectUtil to m_ParticleGameObject FCGameObjectUtil pFCGameObjectUtil = m_ParticleGameObject.GetComponent <FCGameObjectUtil>(); if (pFCGameObjectUtil == null) { pFCGameObjectUtil = m_ParticleGameObject.AddComponent <FCGameObjectUtil>(); } // Call FCGameObjectUtil.SelfRemoveParticle pFCGameObjectUtil.SelfRemoveParticle(m_RemoveDelay, m_ParticleDuration); m_ParticleGameObject = null; } // Destroy m_ParticleGameObject immediately else { Destroy(m_ParticleGameObject); m_ParticleGameObject = null; } }
// Remove Prop after any delay public void Remove(float Delay) { m_RemoveDelay = Delay; // Destroy m_PropGameObject with FCGameObjectUtil if (m_RemoveDelay > 0) { // Attach FCGameObjectUtil to m_PropGameObject FCGameObjectUtil pFCGameObjectUtil = m_PropGameObject.GetComponent <FCGameObjectUtil>(); if (pFCGameObjectUtil == null) { pFCGameObjectUtil = m_PropGameObject.AddComponent <FCGameObjectUtil>(); } // Call FCGameObjectUtil.SelfRemoveParticle pFCGameObjectUtil.SelfRemoveGameObject(m_RemoveDelay, m_FadeOut, m_FadeOutDuration); m_PropGameObject = null; } // Destroy m_PropGameObject immediately else { Destroy(m_PropGameObject); m_PropGameObject = null; } }
public void Show(float PosDelay, float RotationDelay, float ScaleDelay) { #if USE_DOTWEEN // use DOTween: https://www.assetstore.unity3d.com/en/#!/content/27676 Documentation: http://dotween.demigiant.com/documentation.php #elif USE_HOTWEEN // use HOTween: https://www.assetstore.unity3d.com/#/content/3311 Documentation: http://hotween.demigiant.com/documentation.html // tween position m_PosValue = 0; HOTween.To(this, m_PosDuration, new TweenParms() .Prop("m_PosValue", 1.0f, false) .Delay(PosDelay) .Ease(EaseType.EaseOutElastic) .OnStart(UpdateTransformPos_Start) .OnUpdate(UpdateTransformPos_Transforming) .OnStepComplete(UpdateTransformPos_Finished) ); // tween rotation m_RotationValue = 0; if (m_RotationType == FCProp.eRotationType.Endless) { FCGameObjectUtil pFCGameObjectUtil = m_PropGameObject.AddComponent <FCGameObjectUtil>(); pFCGameObjectUtil.InitRotation(m_Rotation); } else if (m_RotationType == FCProp.eRotationType.LimitedRound) { HOTween.To(this, m_RotationDurationPerRound * m_MaxRotationRound, new TweenParms() .Prop("m_RotationValue", (float)m_MaxRotationRound, false) .Delay(RotationDelay) .Ease(EaseType.EaseInOutQuad) .OnStart(UpdateRotation_Start) .OnUpdate(UpdateRotation_Transforming) .OnStepComplete(UpdateRotation_Finished) ); } // tween scale if (m_ScaleType == eScaleType.Enable) { HOTween.To(this, m_ScaleDuration, new TweenParms() .Prop("m_ScaleValue", 1.0f, false) .Delay(ScaleDelay) .Ease(EaseType.EaseOutElastic) .OnStart(UpdateScale_Start) .OnUpdate(UpdateScale_Transforming) .OnStepComplete(UpdateScale_Finished) ); } #elif USE_LEANTWEEN // use LeanTween: https://www.assetstore.unity3d.com/#/content/3595 Documentation: http://dentedpixel.com/LeanTweenDocumentation/classes/LeanTween.html // tween position //UpdateTransformPos_Start(); LeanTween.value(m_PropGameObject, UpdateTransformPos_TransformingWithValue, 0.0f, 1.0f, m_PosDuration) .setDelay(PosDelay) .setEase(LeanTweenType.easeOutElastic) .setOnComplete(UpdateTransformPos_Finished); // tween rotation if (m_RotationType == FCProp.eRotationType.Endless) { FCGameObjectUtil pFCGameObjectUtil = m_PropGameObject.AddComponent <FCGameObjectUtil>(); pFCGameObjectUtil.InitRotation(m_Rotation); } else if (m_RotationType == FCProp.eRotationType.LimitedRound) { //UpdateRotation_Start(); LeanTween.value(m_PropGameObject, UpdateRotation_TransformingWithValue, 0.0f, (float)m_MaxRotationRound, m_RotationDurationPerRound * m_MaxRotationRound) .setDelay(RotationDelay) .setEase(LeanTweenType.easeInOutQuad) .setOnComplete(UpdateRotation_Finished); } // tween scale if (m_ScaleType == eScaleType.Enable) { //UpdateScale_Start(); LeanTween.value(m_PropGameObject, UpdateScale_TransformingWithValue, 0.0f, 1.0f, m_ScaleDuration) .setDelay(ScaleDelay) .setEase(LeanTweenType.easeOutElastic) .setOnComplete(UpdateScale_Finished); } #else // use iTween: https://www.assetstore.unity3d.com/#/content/84 Documentation: http://itween.pixelplacement.com/documentation.php // tween position iTween.ValueTo(m_PropGameObject, iTween.Hash("from", 0, "to", 1, "time", m_PosDuration, "delay", PosDelay, "easeType", FCEaseType.EaseTypeConvert(m_PosEaseType), "onstart", "UpdateTransformPos_Start", "onupdate", "UpdateTransformPos_TransformingWithValue", "onupdatetarget", this.gameObject, "oncomplete", "UpdateTransformPos_Finished")); // tween rotation if (m_RotationType == FCProp.eRotationType.Endless) { FCGameObjectUtil pFCGameObjectUtil = m_PropGameObject.AddComponent <FCGameObjectUtil>(); pFCGameObjectUtil.InitRotation(m_Rotation); pFCGameObjectUtil.StartRotation(); } else if (m_RotationType == FCProp.eRotationType.LimitedRound) { iTween.ValueTo(m_PropGameObject, iTween.Hash("from", 0, "to", m_MaxRotationRound, "time", m_RotationDurationPerRound * m_MaxRotationRound, "delay", RotationDelay, "easeType", FCEaseType.EaseTypeConvert(m_RotationEaseType), "onstart", "UpdateRotation_Start", "onupdate", "UpdateRotation_TransformingWithValue", "onupdatetarget", this.gameObject, "oncomplete", "UpdateRotation_Finished")); } // tween scale if (m_ScaleType == eScaleType.Enable) { iTween.ValueTo(m_PropGameObject, iTween.Hash("from", 0, "to", 1, "time", m_ScaleDuration, "delay", ScaleDelay, "easeType", FCEaseType.EaseTypeConvert(m_ScaleEaseType), "onstart", "UpdateScale_Start", "onupdate", "UpdateScale_TransformingWithValue", "onupdatetarget", this.gameObject, "oncomplete", "UpdateScale_Finished")); } #endif }