Exemplo n.º 1
0
    void Update()
    {
        // Detect death by ring
        RingController ringController = FindObjectOfType <RingController>();

        if (ringController != null && ringController.OutsideRange(HeadPosition.position))
        {
            Health = 0;
            return;
        }

        // Regen health
        if (m_Health < MaxHealth)
        {
            m_RegenTimer -= Time.deltaTime;
            if (m_RegenTimer < 0.0f)
            {
                Health++;
                m_RegenTimer = RegenRate;
            }
        }

        DetectJump();
    }