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); }
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)); }
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(); }
public void PlayerXPCreateTest() { PlayerXP xp = PlayerXP.LoadFromJson("PlayerXP"); Assert.IsNotNull(xp); }