示例#1
0
        public void PlayerXPGetFillAmountTest()
        {
            PlayerXP xp = PlayerXP.LoadFromJson("PlayerXP");

            xp.points = 0;
            Assert.IsTrue(xp.GetFillAmount() == 0);

            xp.points = xp.maxPoints / 2;
            Assert.IsTrue(xp.GetFillAmount() == 0.5);

            xp.points = xp.maxPoints;
            xp.AddPoints(2);
            Assert.IsTrue(xp.GetFillAmount() <= 1);
        }
示例#2
0
        public void PlayerXPAddPointsTest()
        {
            PlayerXP xp = PlayerXP.LoadFromJson("PlayerXP");

            xp.points = 0;
            int points = 1;

            xp.AddPoints(1);
            Assert.IsTrue(xp.points == points);

            xp.points = xp.maxPoints - 1;
            int lvl = xp.currentLevel;

            xp.AddPoints(2);
            Assert.IsTrue(xp.currentLevel == (lvl + 1));
        }
示例#3
0
    public bool isOpened = false; //Открыто ли внутриигровое меню

    void Start()
    {
        playerXP = PlayerXP.LoadFromJson("PX");
        //Commented for debug
        //playerXP = PlayerXP.LoadFromJson(PlayerPrefs.GetString("PlayerJson"));
        playerStats        = PlayerStats.LoadFromJson();
        xpBar              = xpBar.GetComponent <Image>();
        xpText             = xpBar.GetComponentInChildren <Text>();
        xpText.text        = playerXP.CurrentLevel.ToString();
        xpBar.fillAmount   = playerXP.GetFillAmount();
        attackAnim         = GetComponentInChildren <PlayerAttackAnimation>();
        healthText         = hpBar.GetComponentInChildren <Text>();
        hpBar              = hpBar.GetComponent <Image>();
        manaText           = manaBar.GetComponentInChildren <Text>();
        manaBar            = manaBar.GetComponent <Image>();
        nameText.text      = playerStats.name;
        money.text         = playerStats.money.ToString();
        inventory          = GetComponent <Inventory>();
        audio              = GetComponentInChildren <AttackAudio>();
        plusMoneyCoroutine = ShowAddedMoney();
    }
示例#4
0
        public void PlayerXPCreateTest()
        {
            PlayerXP xp = PlayerXP.LoadFromJson("PlayerXP");

            Assert.IsNotNull(xp);
        }