Exemplo n.º 1
0
        public override bool TryExitAbility()
        {
            float height = initialHeight - transform.position.y;

            // Only finish when character found a ground
            if (m_System.IsGrounded)
            {
                if (height >= m_HeightToHardLand)     // Check hard land
                {
                    SetState(m_HardLandState, 0.05f); // Set hard land

                    if (!isHardLand)
                    {
                        float damageAmount = ((height - m_MinHeightToCauseDamagee) / (m_HeightToDie - m_MinHeightToCauseDamagee)) * 100f;
                        if (damageAmount > 0)
                        {
                            GlobalEvents.ExecuteEvent("Damage", gameObject, damageAmount);
                        }
                    }

                    isHardLand             = true;
                    m_UseRootMotion        = true; // use root motion to avoid character keep moving
                    m_FinishOnAnimationEnd = true;
                    return(false);
                }

                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        private void OnTriggerEnter(Collider other)
        {
            if (other.tag == "Enemy")
            {
                return;
            }

            GlobalEvents.ExecuteEvent("Damage", other.gameObject, m_DamageAmount);
        }
 /// <summary>
 /// Execute an animation event called by animation
 /// </summary>
 /// <param name="eventName"></param>
 public void ExecuteAnimationEvent(string eventName)
 {
     GlobalEvents.ExecuteEvent(eventName, gameObject, null);
 }
Exemplo n.º 4
0
        private IEnumerator RestartCharacter()
        {
            yield return(new WaitForSeconds(m_WaitToRestart));

            GlobalEvents.ExecuteEvent("Restart", null, null);
        }