Ejemplo n.º 1
0
    private void OnHitboxEnteredHurtboxEvent(Hitbox hitbox, Hitbox hurtbox)
    {
        print(hitbox.name + " " + hurtbox.name + " entered!");
        InteractionHandler hitInteraction  = hitbox.associatedInteractionHandler;
        InteractionHandler hurtInteraction = hurtbox.associatedInteractionHandler;

        // If the hitbox for this move allows multi hit, then we can register another hit on this frame.
        // If not, only register a hit if the move has not already hit the player.
        // TODO Replace HitBox.AllowMultiHit with (CharacterMove).MultiHit
        // Assuming we want to keep move properties in a
        if (hurtInteraction && hurtInteraction && !hitInteraction.CharactersHit.Contains(hurtInteraction))
        {
            hurtInteraction.OnHitByEnemy(hurtbox, hitbox, hitInteraction && hitInteraction ? hitInteraction.CurrentMove : (default));
Ejemplo n.º 2
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="hitbox"></param>
    /// <param name="hurtbox"></param>
    private void OnHitboxEnteredHurtboxEvent(Hitbox hitbox, Hitbox hurtbox)
    {
        InteractionHandler hitHandler  = hitbox.InteractionHandler;
        InteractionHandler hurtHandler = hurtbox.InteractionHandler;

        // If the hitbox for this move allows multi hit, then we can register another hit on this frame.
        // If not, only register a hit if the move has not already hit the player.
        if (hurtHandler && !hitHandler.MoveHitPlayer)
        {
            if (hurtHandler is CharacterInteractionHandler)
            {
                bool didMoveHit = !WasMoveBlocked(hitHandler.CurrentMove, hitbox, hurtbox);
                hurtHandler.OnHitByEnemy(hurtbox, hitbox, hitHandler.CurrentHitFromMove, didMoveHit);
                hitHandler.OnHitEnemy(hitbox, hurtbox, didMoveHit);
            }
        }
    }