Exemplo n.º 1
0
    public void ExecuteMove(MoveData move)
    {
        if (string.IsNullOrEmpty(move.MoveName))
        {
            return;
        }

        SpecialMeter = Mathf.Max(0f, SpecialMeter - move.SpecialMeterRequired);

        Anim.SetInteger(SpecialMeterParameter, (int)(SpecialMeter / SpecialMeterStockCount));
        OnMoveExecuted.Invoke();
    }
Exemplo n.º 2
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="moveThatHit"></param>
    /// <param name="hitBox"></param>
    /// <param name="hurtBox"></param>
    /// <returns></returns>
    private bool WasMoveBlocked(MoveData moveThatHit, Hitbox hitBox, Hitbox hurtBox)
    {
        CommandInterpreter.DIRECTION hitPlayerInputDirection = hurtBox.InteractionHandler.AssociatedCharacterStats.CommandInterpreter.CurrentDirection;
        CharacterInteractionHandler  hurtInteractionHandler  = hurtBox.InteractionHandler is CharacterInteractionHandler ? (CharacterInteractionHandler)hurtBox.InteractionHandler : null;

        if (hurtInteractionHandler == null)
        {
            return(false);
        }
        bool wasGuarded = hurtInteractionHandler.CanPlayerBlock;

        wasGuarded &= hurtInteractionHandler.Hitstun <= 0;
        if (!wasGuarded)
        {
            return(wasGuarded);
        }

        bool isCharacterCrouching = hurtInteractionHandler.MovementMechanics.IsCrouching;

        // Determine if blocked based on height
        switch (hurtInteractionHandler.CurrentHitFromMove.HitType)
        {
        case HitType.Low:
            wasGuarded &= isCharacterCrouching;
            break;

        case HitType.Air:
            wasGuarded &= !isCharacterCrouching;
            break;
        }

        if (!wasGuarded)
        {
            return(wasGuarded);
        }

        return(wasGuarded & (hitPlayerInputDirection == CommandInterpreter.DIRECTION.BACK || hitPlayerInputDirection == CommandInterpreter.DIRECTION.BACK_DOWN));
    }