Ejemplo n.º 1
0
    private void OnEntityDeath(DeathResult result)
    {
        FightingEntity deadFighter = result.deadEntity.fighter;

        GameManager.Instance.time.GetController().StartCoroutine(deadFighter.Die());

        bool isEnemy = deadFighter.isEnemy();

        if (isEnemy)
        {
            GameManager.Instance.gameState.enemyParty.SetFighter(deadFighter.targetId, null);

            bool          stillHasEnemies = false;
            EnemyObject[] enemies         = GameManager.Instance.battleComponents.field.GetEnemyObjects();
            for (int i = 0; i < enemies.Length; i++)
            {
                if (enemies[i] != null)
                {
                    stillHasEnemies = true;
                    break;
                }
            }

            if (!stillHasEnemies)
            {
                OnWaveComplete();
            }
        }
        else
        {
            if (deadFighter.targetId == 0)
            {
                OnHeroDeath(result);
            }
            else
            {
                GameManager.Instance.gameState.playerParty.EvictPlayer(deadFighter.targetId, true);
            }
        }

        GameManager.Instance.battleComponents.ui.statusBarsUI.UpdateStatusBars();

        // Note: How we determine this part may change depending on how we do Mook deaths:
        List <PlayerObject> allPlayers = GameManager.Instance.battleComponents.field.GetActivePlayerObjects();

        if (allPlayers.Count == 1 && GameManager.Instance.battleComponents.field.GetHeroPlayer().HasModifier(ModifierAilment.MODIFIER_DEATH))
        {
            GameManager.Instance.battleComponents.stageController.LoadDeathScene();
        }
    }
Ejemplo n.º 2
0
    public void EndFight(FightResult fightResult, ActionBase action)
    {
        CheckIfAnyEntityDied(fightResult, action);

        // Mooks should broadcast their fights for clarity
        if (!fighter.isEnemy() && !fighter.IsHero())
        {
            // TODO: do in more clean way
            ActionListener actionListener = fighter.GetComponent <ActionListener>();
            actionListener.EchoMessage(fightResult.GetAnnouncerMessage());
        }

        onFightEnd(fightResult);
    }
Ejemplo n.º 3
0
    private List <FightingEntity> GetAllPossibleTargets(FightingEntity user)
    {
        if (targetInfo.targetTeam == TargetTeam.BOTH_TEAMS)
        {
            return(GameManager.Instance.battleComponents.field.GetAllFightingEntities());
        }
        List <FightingEntity> potentialTargets;
        List <FightingEntity> enemies = new List <FightingEntity>(GameManager.Instance.battleComponents.field.GetEnemyObjects());
        List <FightingEntity> players = new List <FightingEntity>(GameManager.Instance.battleComponents.field.GetPlayerObjects());

        if (user.isEnemy())
        {
            potentialTargets = targetInfo.targetTeam == TargetTeam.MY_TEAM ? enemies : players;
        }
        else
        {
            potentialTargets = targetInfo.targetTeam == TargetTeam.MY_TEAM ? players : enemies;
        }

        return(potentialTargets);
    }