Exemplo n.º 1
0
    /// <summary>
    /// Called by other hitboxes when an attack connects.
    /// This is called BY the affecting, ON the affected.
    /// </summary>
    /// <param name="attack">The attack this hitbox is being hit with.</param>
    public override void Hit(Attack attack)
    {
        if (debug)
        {
            Debug.Log(gameObject.name + " has been hit by " + attack.kData.name);
        }
        switch (state)
        {
        case State.Normal:
            m_hitManager.AddAttack(attack);
            break;

        case State.Block:
            attack.damageMultiplier *= attack.kData.Chip;
            attack.launchScale.x     = blockingLaunchScale;
            attack.launchScale.y     = (m_parent.Grounded ? 0 : blockingLaunchScale);
            attack.wasBlocked        = true;
            goto case State.Normal;

        case State.Attack:
            if (attack.kData.Priority > m_attack.Priority)
            {
                goto case State.Normal;
            }
            else if (attack.kData.Priority == m_attack.Priority)
            {
                m_hitManager.AddAttack(GenerateAttack(m_conflcitResolution));
            }
            break;

        default:
            Debug.LogError(InvalidStateSelectionError);
            goto case State.Normal;
        }
    }