Exemplo n.º 1
0
 private void Start()
 {
     CharacterStats     = Overseer.Instance.PlayerObjects[CharacterId].GetComponent <CharacterStats>();
     InteractionHandler = CharacterStats.gameObject.GetComponent <CharacterInteractionHandler>();
     CharacterStats.OnMoveHit.AddListener(OnComboCountChanged);
     CharacterStats.OnComboFinished.AddListener(OnComboFinished);
     OnComboCountChanged();
 }
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));
    }