Esempio n. 1
0
    private IEnumerator ResolveOverwatchAttacksCoroutine(LivingEntity characterMoved, Action action, Tile previousLocation)
    {
        Debug.Log("MovementLogic.ResolveOverwatchAttacks() called....");
        List <LivingEntity> unfriendlyEntities = new List <LivingEntity>();

        foreach (LivingEntity entity in LivingEntityManager.Instance.allLivingEntities)
        {
            if (entity.myPassiveManager.overwatch)
            {
                if (CombatLogic.Instance.IsTargetFriendly(characterMoved, entity) == false)
                {
                    unfriendlyEntities.Add(entity);
                }
            }
        }

        foreach (LivingEntity entity in unfriendlyEntities)
        {
            if (LevelManager.Instance.IsTileYWithinRangeOfTileX(entity.tile, previousLocation, 5) &&
                EntityLogic.IsTargetVisible(entity, characterMoved) &&
                characterMoved.inDeathProcess == false)
            {
                Debug.Log("ResolveOverwatchCoroutine() detected that " + characterMoved.name + " triggered an overwatch shot from " + entity.name);
                movementPaused = true;
                characterMoved.PlayIdleAnimation();
                Action overwatchShotAction = AbilityLogic.Instance.PerformOverwatchShot(entity, characterMoved);
                yield return(new WaitUntil(() => overwatchShotAction.ActionResolved() == true));

                // Resume movement
                characterMoved.PlayMoveAnimation();
                movementPaused = false;
            }
        }

        action.actionResolved = true;
    }