Example #1
0
        public void UpdateUI(int currentHealth)
        {
            float progress = (float)currentHealth / m_MaxHealth;

            m_LerpData.From = Image_FG.fillAmount;
            m_LerpData.To   = progress;
            m_LerpData.Start();
        }
Example #2
0
 void Fade(float alpha)
 {
     m_FadeImage.enabled = true;
     m_LerpData          = new Utils.InterpolationData <Color>(m_FadeTime);
     m_LerpData.From     = m_FadeImage.color;
     m_LerpData.To       = m_LerpData.From;
     m_LerpData.To.a     = alpha;
     m_LerpData.Start();
 }
Example #3
0
        public void AlignToOffset(Transform target, Vector3 offset)
        {
            m_Target = target;

            //От текущей позиции до позиции цели с учетом смещения
            m_PositionLerpData.From = transform.position;
            m_PositionLerpData.To   = m_Target.transform.position + offset;

            //От текущего вращения
            m_RotationLerpData.From = transform.rotation;
            //m_RotationLerpData.To = Quaternion.LookRotation(m_Target.transform.position - transform.position);

            m_PositionLerpData.Start();
        }
        public void Dodge(Vector2 dir)
        {
            if (m_DodgeTimeLerpData.IsStarted)
            {
                return;
            }

            m_DodgeDir = new Vector3(dir.x, 0, dir.y);

            if (OnDodgeStarted != null)
            {
                OnDodgeStarted();
            }

            float dodgeTime = DodgeDist / DodgeSpeed;

            m_DodgeTimeLerpData = new Utils.InterpolationData <float>(dodgeTime);
            m_DodgeTimeLerpData.Start();
        }
 public virtual void StartAnimation(float targetValue)
 {
     m_LerpData.Start();
 }
Example #6
0
 public void MoveToWithOffset(Transform target, Vector3 offset)
 {
     m_LerpData.From = transform.position;
     m_LerpData.To   = target.position + offset;
     m_LerpData.Start();
 }