Exemple #1
0
    void Die()
    {
        if (m_Dead)
        {
            return;
        }

        GlobalData.DispatchHeroDied();

        m_Dead    = true;
        m_CanMove = false;
        m_CanJump = false;
        m_Rigidbody2D.freezeRotation = false;

        var velocity = m_Rigidbody2D.velocity;

        velocity.y             = m_DeathVelocity;
        m_Rigidbody2D.velocity = velocity;
        var angularVelocity = m_FacingLeft ? m_DeathAngularVelocity : -m_DeathAngularVelocity;

        m_Rigidbody2D.angularVelocity = angularVelocity;

        if (m_Boosting)
        {
            EndBoosting();
        }

        m_DeathSequence.Cancel();
        m_DeathSequence = ActionMaster.Actions.Sequence();
        m_DeathSequence.SpriteAlpha(m_BodySpriteRenderer.gameObject, 0, m_DeathPreDelay, new Ease(Ease.Quad.Out));
        m_DeathSequence.Call(Return, gameObject);
        m_DeathSequence.Delay(m_DeathPostDelay);
        m_DeathSequence.Call(RegainControl, gameObject);
    }
Exemple #2
0
    private void BlinkDelay()
    {
        var delay             = Random.Range(m_MinDelay, m_MaxDelay);
        var shouldDoubleBlink = Random.value < m_DoubleBlinkProbability;

        m_BlinkSequence.Delay(delay);

        if (shouldDoubleBlink)
        {
            m_BlinkSequence.Call(DoubleBlink, gameObject);
        }
        else
        {
            m_BlinkSequence.Call(Blink, gameObject);
        }
    }
Exemple #3
0
    void FadeIn(Color color, float fadeDuration, float delay)
    {
        color.a         = 0;
        m_Image.enabled = true;
        m_Image.color   = color;

        m_FadeSequence.Cancel();
        m_FadeSequence = ActionMaster.Actions.Sequence();
        m_FadeSequence.UiAlpha(gameObject, 1, fadeDuration, new Ease(Ease.Quad.InOut));
        m_FadeSequence.Delay(delay);
        m_FadeSequence.Call(FadeInEnded, gameObject);
    }