예제 #1
0
    //Method that updates timer.
    //  Pre: Called within a looping function (PKMNEntity's Update)
    //  Post: Updates timer IF there are any elements present in the queue and checks it with
    //        the front most element
    public void update()
    {
        if (qStruct.Count > 0)
        {
            float delta = Time.deltaTime;
            timer += delta;       //Update Timer

            //Poison method
            if (poisonIntensity > 0f)
            {
                pTimer += delta;

                if (pTimer > POISON_TICK)
                {
                    pTimer = 0f;
                    int damage = entity.accessBaseStat(BaseStat.HEALTH) / curPoisonDamage;
                    entity.StartCoroutine(entity.receiveDoT(damage, null));
                }
            }

            //If timer exceeds the current duration, remove and reverse the effect
            if (timer >= qStruct.First.Value.getDuration())
            {
                StatEffect finishedSE = this.remove();
                finishedSE.reverseEffect(this.entity);
            }
        }
    }
예제 #2
0
    //Upgrades stat upon button press
    public void upgradeStat()
    {
        numStatBoosts += 1;
        PKMNEntity linkedFighter = fighterInfo.getFighter();

        linkedFighter.useStatBoost(baseStat, potentialStat);    //Upgrades stat

        //Updates display
        statBar.fillAmount    = linkedFighter.accessBaseStat(baseStat) / MAX_STAT;
        statBoostDisplay.text = linkedFighter.getStatBoostsUsed(baseStat) + "/" + MAX_UPGRADES;

        //Indicate to main menu that an upgrade has happened
        fighterInfo.uponUpgrade(this);
    }
예제 #3
0
    //Displays ALL fighter information and sets menu up
    public void displayFighterInfo(int newIndex)
    {
        //Get Fighter
        int prevIndex = fighterIndex;

        fighterIndex = newIndex;
        PKMNEntity fighter = fighters[fighterIndex];

        //Update ALL Info
        health.fillAmount = fighter.healthBar.fillAmount;
        float curHealth = fighter.accessStat(BaseStat.HEALTH);

        curHealth       = (curHealth <= 0) ? 0 : (curHealth < 1) ? 1 : curHealth;
        healthText.text = (int)curHealth + "/" + fighter.accessBaseStat(BaseStat.HEALTH);

        armor.fillAmount = fighter.armorBar.fillAmount;
        armorText.text   = fighter.armorToString();

        levelDisplay.text   = "Level: " + fighter.level;
        exp.fillAmount      = fighter.getPercentToLvL();
        availableUpgrades   = fighter.getNumStatBoosts();
        openBoostsText.text = "" + availableUpgrades;

        numOpenBoosts.color = (availableUpgrades > 0) ? upgradeReady : noUpgrade;

        //Update base stats
        foreach (SingleBaseStat baseStat in baseStatDisplays)
        {
            baseStat.displayFighterInfo(fighter);

            if (availableUpgrades > 0)
            {
                baseStat.displayPotentialUpgrade();
            }
            else
            {
                baseStat.disablePotentialUpgrade();
            }
        }

        //Update buttons
        fighterButtons[fighterIndex].interactable = false;
        fighterButtons[prevIndex].interactable    = true;
    }
예제 #4
0
 //Displays fighter info onto single base stat display
 //  Pre: fighter must be alive and not null with specified baseStat
 //  Post: Displays fighter's boosts used on stat and base stat value
 public void displayFighterInfo(PKMNEntity fighter)
 {
     numStatBoosts         = fighter.getStatBoostsUsed(baseStat);
     statBar.fillAmount    = fighter.accessBaseStat(baseStat) / MAX_STAT;
     statBoostDisplay.text = numStatBoosts + "/" + MAX_UPGRADES;
 }