void UpdateAttackAnimation(float delta_time)
    {
        secondsRemainingInAttack -= delta_time;
        if (secondsRemainingInAttack <= 0)
        {
            // Clear out both to ensure we're ignoring input entered while
            // attacking. We only pick up the next attack after the attack.
            currentAttackDirection = eAttackDirection.NoAttack;
            nextAttackDirection    = eAttackDirection.NoAttack;

            // attack is now invalid, abort.
            return;
        }

        GameObject target = GetTargetDamager(currentAttackDirection);

        if (target == null)
        {
            return;
        }

        float spin_progress = CalcAttackProgressPercent();

        float direction = 1f;

        if (currentAttackDirection == eAttackDirection.Right)
        {
            direction = -1f;
        }

        var anim = target.GetComponent <LofiTransformAnimation>();

        anim.UpdateWithProgress(spin_progress, direction);
    }
    void ProcessNextAttack()
    {
        Dbg.Assert(!IsAttackInProgress(), "Precondition violated.");

        currentAttackDirection   = nextAttackDirection;
        nextAttackDirection      = eAttackDirection.NoAttack;
        secondsRemainingInAttack = attackDurationSeconds;
    }
    GameObject DetermineAttackTarget(eAttackDirection direction)
    {
        GameObject damager = GetTargetDamager(currentAttackDirection);

        if (damager == null)
        {
            return(null);
        }

        var collisions = damager.GetComponentInChildren <ColliderCollector>();

        Dbg.Assert(collisions != null, "Damager objects must contain a ColliderCollector in their hierarchy to determine what we've collided against to damage.");
        return(collisions.GetFirstOverlappingRootObject());
    }
    GameObject GetTargetDamager(eAttackDirection direction)
    {
        switch (currentAttackDirection)
        {
        case eAttackDirection.Right:
            return(rightDamager);

        case eAttackDirection.Left:
            return(leftDamager);

        case eAttackDirection.Back:
            return(backDamager);

        case eAttackDirection.NoAttack:
            Dbg.Assert(false, "Should not UpdateAttack invalid attack.");
            break;
        }

        Dbg.Assert(false, "Invalid eAttackDirection: " + direction.ToString());
        return(null);
    }
 public void QueueAttack(eAttackDirection direction)
 {
     nextAttackDirection = direction;
 }
 void AbortAttack()
 {
     currentAttackDirection = eAttackDirection.NoAttack;
 }