FiE-Game/Assets/Scripts/Fie/Title/FieTitleOrbitalParticle.cs

44 lines
996 B
C#
Raw Normal View History

2018-11-20 20:10:49 +01:00
using UnityEngine;
namespace Fie.Title
{
public class FieTitleOrbitalParticle : MonoBehaviour
{
[SerializeField]
private Transform _orbitCenterTransform;
[SerializeField]
private Transform _orbitRadiucTransform;
[SerializeField]
private PKFxFX _orbitalParticle;
private PKFxManager.Attribute _orbitalAttribute;
private bool _isEnable = true;
private void Awake()
{
_orbitalAttribute = new PKFxManager.Attribute("OrbitalRadius", 1f);
int qualityLevel = QualitySettings.GetQualityLevel();
if (qualityLevel == 0 || qualityLevel == 1)
{
if (_orbitalParticle.Alive())
{
_orbitalParticle.KillEffect();
}
_isEnable = false;
}
}
private void LateUpdate()
{
if (_isEnable && _orbitalParticle.AttributeExists(_orbitalAttribute.m_Descriptor))
{
_orbitalAttribute.ValueFloat = Vector3.Distance(_orbitCenterTransform.position, _orbitRadiucTransform.position);
_orbitalParticle.SetAttribute(_orbitalAttribute);
}
}
}
}