Exemple #1
0
    public void Initialize(FightingEntity target, int damage, DamageType damageType)
    {
        // Format based on damage type
        if (damageType == DamageType.HEALING)
        {
            damage            = Mathf.Abs(damage);
            _damageText.color = _healColour;
        }
        else if (damageType == DamageType.MANA_RECOVERY)
        {
            _damageText.color = _manaRecoveryColour;
        }

        // Set position
        FighterPositions uiPositions = target.GetComponent <FighterPositions>();

        if (uiPositions != null)
        {
            _worldPosition = uiPositions.damagePopup.position;
        }
        else
        {
            Debug.LogWarning(target.name + " has no damagePopupLocation");
        }
        _worldToScreen.SetWorldPoint(_worldPosition);

        SetText(damage);
        GameManager.Instance.time.GetController().StartCoroutine(Fade());
    }
Exemple #2
0
    public void InitializePosition(FightingEntity player)
    {
        this.fighter          = player;
        this.fighter.targetId = this.slotIndex;
        player.transform.SetParent(this.instantiationTransform.transform, false);
        player.transform.localPosition = Vector3.zero;
        if (player.fighterMessageBox != null)
        {
            player.fighterMessageBox.Initialize(this.IsXFlipped());
        }

        player.fighterSlot = this;

        // Set arrows position based on fighter's specification
        WorldspaceToScreenUI parentPositioner = targetParent.GetComponent <WorldspaceToScreenUI>();

        parentPositioner.SetWorldPoint(fighter.GetComponent <FighterPositions>().arrows);
    }
Exemple #3
0
    public void UpdateStatusBars()
    {
        PlayerObject[] players = GameManager.Instance.battleComponents.field.GetPlayerObjects();

        for (int i = 0; i < players.Length; i++)
        {
            if (this.statusBars[i] == null)
            {
                continue;
            }

            PlayerObject player = players[i];

            if (player == null)
            {
                this.statusBars[i].gameObject.SetActive(false);
                continue;
            }

            if (i == 0)
            {
                // Heros have mana
                ManaStatusBarUI heroStatusBar = (ManaStatusBarUI)statusBars[i];
                heroStatusBar.SetFighter(player);
                heroStatusBar.SetName(player.Name);
                heroStatusBar.SetHP(player.stats.hp.GetValue(), player.stats.maxHp.GetValue());
                heroStatusBar.SetMana(player.stats.mana.GetValue(), player.stats.maxMana.GetValue());
                heroStatusBar.SetNameColor(player.GetOrderColor());
                heroStatusBar.SetStatusAilmentIcons(player.ailmentController.GetAllAilments().Map(entry => entry.Value));
            }
            else
            {
                // Mooks have energy
                MookStatusBarUI mookStatusBar = (MookStatusBarUI)statusBars[i];
                mookStatusBar.SetFighter(player);
                mookStatusBar.SetName(player.Name);
                mookStatusBar.SetHP(player.stats.hp.GetValue(), player.stats.maxHp.GetValue());
                mookStatusBar.SetStatusAilmentIcons(player.ailmentController.GetAllAilments().Map(entry => entry.Value));
                // Note: Energy might be its own thing later, but for now, lets just use mana

                mookStatusBar.SetEnergy(player.ailmentController.GetAilment("Out of Juice").duration, maxMookEnergy);
                mookStatusBar.SetNameColor(player.GetOrderColor());
                if (!player.HasSetCommand())
                {
                    mookStatusBar.actionMenuUI.UnsetActions();
                }
            }

            this.statusBars[i].gameObject.SetActive(true);
        }

        EnemyObject[] enemies = GameManager.Instance.battleComponents.field.GetEnemyObjects();

        for (int i = 0; i < enemies.Length; i++)
        {
            if (this.enemyStatusBars[i] == null)
            {
                continue;
            }

            EnemyObject enemy = enemies[i];
            if (enemy == null)
            {
                this.enemyStatusBars[i].gameObject.SetActive(false);
                continue;
            }

            enemyStatusBars[i].SetFighter(enemy);
            enemyStatusBars[i].SetName(enemies[i].targetName);
            enemyStatusBars[i].SetHP(enemies[i].stats.hp.GetValue(), enemies[i].stats.maxHp.GetValue());
            enemyStatusBars[i].SetStatusAilmentIcons(enemy.ailmentController.GetAllAilments().Map(entry => entry.Value).Filter(ailment => ailment.icon != null));
            Transform            barMarker     = enemy.GetComponent <FighterPositions>().statusBar;
            WorldspaceToScreenUI barPositioner = enemyStatusBars[i].GetComponent <WorldspaceToScreenUI>();
            barPositioner.SetWorldPoint(barMarker);

            this.enemyStatusBars[i].gameObject.SetActive(true);
        }
    }