Example #1
0
 public void TweenedSomeValue(int val)
 {
     progress = val;
     //Debug.Log("Tween Monster: " + meta.ToString());
     int[] lvlCalc = MonsterMeta.CalcLvl(meta, lvlUpSpeed);
     meta.exp += progress - lvlCalc[1];
     UpdateExperience(lvlUpSpeed, meta);
 }
Example #2
0
    public void UpdateExperience(MonsterMeta.lvlUpSpeed lvlUpSpeed, PlayerRosterMeta meta)
    {
        //Debug.Log("UpdateExperience");
        //Debug.Log(meta.ToString());

        this.lvlUpSpeed = lvlUpSpeed;
        this.meta       = new PlayerRosterMeta(meta);

        //Returns [level, currentLvlExp, neededExp]
        int[] lvlCalc = MonsterMeta.CalcLvl(meta, lvlUpSpeed);
        meta.lvl = lvlCalc[0];
        progress = lvlCalc[1];
        MAX_EXP  = lvlCalc[2];

        gameObject.GetComponent <Image>().fillAmount          = progress / (float)MAX_EXP;
        GameObject.Find("HLvlTxt").GetComponent <Text>().text = lvlCalc[0].ToString();
        //Debug.Log("updateExp init: " + lvlCalc[0].ToString() + "/" + lvlCalc[1].ToString());
    }
Example #3
0
    void loadRoster()
    {
        AdventureMeta meta = BaseSaver.getAdventure();

        for (int i = 1; i < 7; i++)
        {
            if (meta.roster.Length >= i)
            {
                Debug.Log("I: " + i.ToString());
                Debug.Log("Monster Name: " + meta.roster[i - 1].name);
                rosterSubPnls[i - 1].SetActive(true);
                string img       = "M0" + i.ToString() + "Img";
                string health    = "M0" + i.ToString() + "Health";
                string healthTxt = "M0" + i.ToString() + "HealthTxt";
                string mName     = "M0" + i.ToString() + "Name";
                string mLvl      = "M0" + i.ToString() + "lvl";
                string mExp      = "M0" + i.ToString() + "Exp";
                string mExpTxt   = "M0" + i.ToString() + "ExpTxt";
                string mPowTxt   = "M0" + i.ToString() + "Pow";

                int[] lvlCalc = MonsterMeta.CalcLvl(meta.roster[i - 1], glossy.GetMonsterMain(meta.roster[i - 1].name).meta.lvlSpeed);

                GameObject.Find(img).GetComponent <Image>().sprite = glossy.GetMonsterImage(meta.roster[i - 1].name);

                GameObject.Find(health).GetComponent <Image>().fillAmount = (meta.roster[i - 1].curHealth / (float)meta.roster[i - 1].maxHealth);
                GameObject.Find(healthTxt).GetComponent <Text>().text     = meta.roster[i - 1].curHealth.ToString() + " / " + meta.roster[i - 1].maxHealth.ToString();

                GameObject.Find(mExp).GetComponent <Image>().fillAmount = (lvlCalc[1] / (float)lvlCalc[2]);
                GameObject.Find(mExpTxt).GetComponent <Text>().text     = (lvlCalc[2] - lvlCalc[1]).ToString();

                GameObject.Find(mName).GetComponent <Text>().text = meta.roster[i - 1].nickname.Length > 0 ? meta.roster[i - 1].nickname : meta.roster[i - 1].name;
                GameObject.Find(mLvl).GetComponent <Text>().text  = lvlCalc[0].ToString();

                Debug.Log("Power: " + meta.roster[i - 1].getPower().ToString("0.00"));

                GameObject.Find(mPowTxt).GetComponent <Text>().text = "POW: <color=#ff0000>" + meta.roster[i - 1].getPower().ToString("0.00") + "</color>";
            }
            else
            {
                rosterSubPnls[i - 1].SetActive(false);
            }
        }
    }
Example #4
0
    void loadRosterInfo(int clk)
    {
        currentRosterMonster = clk - 1;

        if (rosterNickname == null)
        {
            rosterNickname = GameObject.Find("LNickName");
        }
        if (rosterEdit == null)
        {
            rosterEdit = GameObject.Find("NickNameEdit");
        }
        if (rosterInput == null)
        {
            rosterInput = GameObject.Find("LNickNameInput");
        }
        rosterInput.SetActive(false);

        AdventureMeta    playerMeta       = BaseSaver.getAdventure();
        PlayerRosterMeta monsterMetaShort = playerMeta.roster[currentRosterMonster];
        MonsterMeta      monsterMetaLong  = glossy.GetMonsterMain(monsterMetaShort.name).meta;

        int[] lvlInfo = MonsterMeta.CalcLvl(monsterMetaShort, monsterMetaLong.lvlSpeed);

        GameObject.Find("LImg").GetComponent <Image>().sprite = glossy.GetMonsterImage(monsterMetaShort.name);
        GameObject.Find("Llvl").GetComponent <Text>().text    = lvlInfo[0].ToString();
        GameObject.Find("LName").GetComponent <Text>().text   = monsterMetaShort.name;
        rosterNickname.GetComponent <Text>().text             = "\"" + monsterMetaShort.nickname + "\"";

        GameObject.Find("HealthTxt").GetComponent <Text>().text = "Health: " + monsterMetaShort.maxHealth.ToString();
        GameObject.Find("ExpTxt").GetComponent <Text>().text    = "Exp: " + monsterMetaShort.exp.ToString();
        GameObject.Find("Stat01Txt").GetComponent <Text>().text = "Lust: " + monsterMetaShort.lust.ToString("0.00");
        GameObject.Find("Stat02Txt").GetComponent <Text>().text = "Greed: " + monsterMetaShort.greed.ToString("0.00");
        GameObject.Find("Stat03Txt").GetComponent <Text>().text = "Wrath: " + monsterMetaShort.wrath.ToString("0.00");
        GameObject.Find("Stat04Txt").GetComponent <Text>().text = "Pride: " + monsterMetaShort.pride.ToString("0.00");
        GameObject.Find("Stat05Txt").GetComponent <Text>().text = "Gluttony: " + monsterMetaShort.gluttony.ToString("0.00");
        GameObject.Find("Stat06Txt").GetComponent <Text>().text = "Sloth: " + monsterMetaShort.sloth.ToString("0.00");
        GameObject.Find("Stat07Txt").GetComponent <Text>().text = "Envy: " + monsterMetaShort.envy.ToString("0.00");
        GameObject.Find("Stat08Txt").GetComponent <Text>().text = "Lrn: " + monsterMetaLong.lvlSpeed.ToString();

        List <string>    mSkills = new List <string>(monsterMetaShort.skills);
        List <SkillMeta> sMetas  = new List <SkillMeta>(GameUtilities.parseSkills(monsterMetaShort.skills, glossy));

        for (int i = 0; i < 2; i++)
        {
            if (monsterMetaLong.strengths.Length > i)
            {
                GameObject.Find("LType" + (i + 1).ToString() + "Txt").GetComponent <Text>().text = monsterMetaLong.strengths[i].ToString();
                //GameObject.Find("LType" + (i + 1).ToString()).GetComponent<Image>().enabled = true;
                //GameObject.Find("LType" + (i+1).ToString()).GetComponent<Image>().sprite = glossy.getGemSprite(MonsterMeta.elementToGem(monsterMetaLong.strengths[i]));
            }
            else
            {
                //GameObject.Find("LType" + (i + 1).ToString()).GetComponent<Image>().enabled = false;
                GameObject.Find("LType" + (i + 1).ToString() + "Txt").GetComponent <Text>().text = "";
            }
        }

        for (int i = 0; i < 4; i++)
        {
            if (mSkills.Count > i)
            {
                GameObject.Find("Sk0" + (i + 1) + "Res01Gem").GetComponent <Image>().enabled = true;
                GameObject.Find("Sk0" + (i + 1) + "Res02Gem").GetComponent <Image>().enabled = true;

                GameObject.Find("LSk0" + (i + 1) + "C").GetComponent <Text>().text     = mSkills[i];
                GameObject.Find("LSk0" + (i + 1) + "CDesc").GetComponent <Text>().text = PanelManager.getEffectsString(sMetas[i].effects);

                GameObject.Find("Sk0" + (i + 1) + "Res01Txt").GetComponent <Text>().text    = sMetas[i].req1.req.ToString();
                GameObject.Find("Sk0" + (i + 1) + "Res01Gem").GetComponent <Image>().sprite = glossy.getGemSprite(sMetas[i].req1.gem);
                GameObject.Find("Sk0" + (i + 1) + "Res02Txt").GetComponent <Text>().text    = sMetas[i].req2.req.ToString();
                GameObject.Find("Sk0" + (i + 1) + "Res02Gem").GetComponent <Image>().sprite = glossy.getGemSprite(sMetas[i].req2.gem);
            }
            else
            {
                GameObject.Find("LSk0" + (i + 1) + "C").GetComponent <Text>().text     = "";
                GameObject.Find("LSk0" + (i + 1) + "CDesc").GetComponent <Text>().text = "";

                GameObject.Find("Sk0" + (i + 1) + "Res01Txt").GetComponent <Text>().text     = "";
                GameObject.Find("Sk0" + (i + 1) + "Res02Txt").GetComponent <Text>().text     = "";
                GameObject.Find("Sk0" + (i + 1) + "Res01Gem").GetComponent <Image>().enabled = false;
                GameObject.Find("Sk0" + (i + 1) + "Res02Gem").GetComponent <Image>().enabled = false;
            }
        }
    }
Example #5
0
    public void ShowLevelUpScreen(PlayerRosterMeta meta, int exp)
    {
        lvlUpPanel.SetActive(true);
        boardManager.SetActive(false);
        backgroundShift = shiftLvlUpBackgroundColors();
        StartCoroutine(backgroundShift);

        Glossary    glossy   = PanelManager.instance.glossaryObj.GetComponent <Glossary>();
        MonsterMeta fullMeta = glossy.GetMonsterMain(meta.name).meta;

        int[] lvlInfoBefore = MonsterMeta.CalcLvl(meta, fullMeta.lvlSpeed);
        meta.exp += exp;
        int[] lvlInfoAfter = MonsterMeta.CalcLvl(meta, fullMeta.lvlSpeed);

        List <string> newSkills = new List <string>(meta.skills);

        float[] increases  = new float[] { 0, 0, 0, 0, 0, 0, 0 };
        int     lvlsGained = lvlInfoAfter[0] - lvlInfoBefore[0];

        for (int i = 0; i < lvlsGained; i++)
        {
            float[] updates = MonsterMeta.returnLvlUpdates(fullMeta, meta);
            increases[0] += updates[0];
            increases[1] += updates[1];
            increases[2] += updates[2];
            increases[3] += updates[3];
            increases[4] += updates[4];
            increases[5] += updates[5];
            increases[6] += updates[6];

            foreach (lvlUpSkills skill in fullMeta.skillsGainedOnLvlUp)
            {
                if (meta.lvl + i + 1 == skill.lvl)
                {
                    newSkills.Add(skill.skill);
                }
            }
        }

        if (newSkills.Count > 4)
        {
            choosingSkill = true;
            GameObject.Find("NxtBtnTxt").GetComponent <Text>().text     = "Toss";
            GameObject.Find("WarningTxt").GetComponent <Text>().enabled = true;
            skillSelected = -1;
        }
        else
        {
            GameObject.Find("WarningTxt").GetComponent <Text>().enabled = false;
        }

        meta.lust     += increases[0];
        meta.greed    += increases[1];
        meta.wrath    += increases[2];
        meta.pride    += increases[3];
        meta.gluttony += increases[4];
        meta.sloth    += increases[5];
        meta.envy     += increases[6];

        int healthInc = 0;

        meta.gluttony_bonus += (meta.gluttony + .45f) * lvlsGained;
        if (meta.gluttony_bonus >= 1)
        {
            healthInc           = (int)meta.gluttony_bonus;
            meta.maxHealth     += healthInc;
            meta.gluttony_bonus = meta.gluttony_bonus - ((int)meta.gluttony_bonus);
        }

        GameObject.Find("LImg").GetComponent <Image>().sprite = glossy.GetMonsterImage(meta.name);
        GameObject.Find("Llvl").GetComponent <Text>().text    = lvlInfoAfter[0].ToString();
        GameObject.Find("LName").GetComponent <Text>().text   = meta.name;

        //GameObject.Find("HealthTxt").GetComponent<Text>().text = "Health: " + meta.maxHealth.ToString() + " (<color=#ff0000>+" + healthInc + "</color>)";
        //GameObject.Find("ExpTxt").GetComponent<Text>().text = "Exp: " + meta.exp.ToString() + " (<color=#0000ff>" + (lvlInfoAfter[2] - lvlInfoAfter[1]).ToString() + "</color>)";
        //GameObject.Find("Stat01Txt").GetComponent<Text>().text = "Lust: " + meta.lust.ToString("0.00") + " (<color=#ff0000>+" + increases[0].ToString("0.00") + "</color>)";
        //GameObject.Find("Stat02Txt").GetComponent<Text>().text = "Greed: " + meta.greed.ToString("0.00") + " (<color=#ff0000>+" + increases[1].ToString("0.00") + "</color>)";
        //GameObject.Find("Stat03Txt").GetComponent<Text>().text = "Wrath: " + meta.wrath.ToString("0.00") + " (<color=#ff0000>+" + increases[2].ToString("0.00") + "</color>)";
        //GameObject.Find("Stat04Txt").GetComponent<Text>().text = "Pride: " + meta.pride.ToString("0.00") + " (<color=#ff0000>+" + increases[3].ToString("0.00") + "</color>)";
        //GameObject.Find("Stat05Txt").GetComponent<Text>().text = "Gluttony: " + meta.gluttony.ToString("0.00") + " (<color=#ff0000>+" + increases[4].ToString("0.00") + "</color>)";
        //GameObject.Find("Stat06Txt").GetComponent<Text>().text = "Sloth: " + meta.sloth.ToString("0.00") + " (<color=#ff0000>+" + increases[5].ToString("0.00") + "</color>)";
        //GameObject.Find("Stat07Txt").GetComponent<Text>().text = "Envy: " + meta.envy.ToString("0.00") + " (<color=#ff0000>+" + increases[6].ToString("0.00") + "</color>)";
        StartCoroutine(IncrementLvlUpTxt(meta, lvlInfoAfter, increases, healthInc));
        GameObject.Find("Stat08Txt").GetComponent <Text>().text = "Lrn: " + fullMeta.lvlSpeed.ToString();

        List <string> mSkills = new List <string>(meta.skills);

        //for (int i = 0; i < 4; i++){
        //  if (newSkills.Count > i) {
        //    GameObject.Find("LSk0" + (i + 1) + "C").GetComponent<Text>().text =  mSkills.Contains(newSkills[i]) ? newSkills[i] : "<color=#0000ff>" + newSkills[i] + "</color>";
        //  } else {
        //    GameObject.Find("LSk0" + (i + 1) + "C").GetComponent<Text>().text = "";
        //  }
        //}

        //GameObject.Find("LSk05C").GetComponent<Text>().text = "";

        loadLvlUpSkills(mSkills, newSkills);

        meta.skills    = newSkills.ToArray();
        meta.curHealth = meta.maxHealth;

        lastMeta = meta;
        //PanelManager.instance.updateCurrent(meta);
    }