public void GainXP(BattleResultEventData data) { //Checking outcome and the data for xp, and debug logging it Debug.Log(data.outcome); Debug.Log(data.Xp); Debug.Log(data.player.xp); Debug.Log(data.npc.xp); if (data.outcome == 1) { data.player.xp += data.Xp; Debug.Log("Player has gained " + data.player.xp + "Xp"); //if outcome = 1 add xp to the player and debug how much you gained } if (data.player.xp >= 100 + (data.player.level * 50)) { data.player.level += 1; //add 1 to the player level GameEvents.PlayerLevelUp(data.player.level); //broadcast level up message Debug.Log("Player has level is " + data.player.level); //debug which level the player is int numPoints = 5; StatsGenerator.AssignUnusedPoints(data.player, 5); // assign 5 points each time data.player.xp = 0; //set xp back to 0 } }
public void GainXP(BattleResultEventData data) { Debug.Log(data.outcome); Debug.Log(data.player.level); Debug.Log(data.player.xp); //checking if player won and then assigning xp if (data.outcome == 1) { data.player.xp += 10; } else { data.player.xp += 2; } if (data.player.xp >= xpRequired) { data.player.level++; Debug.Log("Level is now: " + data.player.level); int pointsToAdd = 10; StatsGenerator.AssignUnusedPoints(data.player, pointsToAdd); GameEvents.PlayerLevelUp(data.player.level); xpRequired += (xpRequired * (data.player.level / 2)); Debug.Log(xpRequired); } // if data.outcome is 1 then player won, otherwise player lost }
public void GainXP(BattleResultEventData data) { //sets xp to zero (does not effect previous file) data.player.xp = 0; //tries to read the xp from text file try { data.player.xp = System.Convert.ToInt32(System.IO.File.ReadAllText("xp.txt")); } catch { } //adds xp based on win if (data.outcome == 1) { data.player.xp += 20; Debug.Log("win"); Debug.Log(data.player.xp); } if (data.outcome == 0) { data.player.xp += 10; Debug.Log("lose"); Debug.Log(data.player.xp); } //checks level based on total xp if (data.player.xp >= 100 && data.player.level < 2) { data.player.level += 1; GameEvents.PlayerLevelUp(data.player.level); StatsGenerator.AssignUnusedPoints(data.player, 10); Debug.Log("Level Up"); } if (data.player.xp >= 200 && data.player.level < 3) { data.player.level += 1; GameEvents.PlayerLevelUp(data.player.level); StatsGenerator.AssignUnusedPoints(data.player, 10); Debug.Log("Level Up"); } if (data.player.xp >= 300 && data.player.level < 4) { data.player.level += 1; GameEvents.PlayerLevelUp(data.player.level); StatsGenerator.AssignUnusedPoints(data.player, 10); Debug.Log("Level Up"); } if (data.player.xp >= 500 && data.player.level < 5) { data.player.level += 1; GameEvents.PlayerLevelUp(data.player.level); StatsGenerator.AssignUnusedPoints(data.player, 10); Debug.Log("Level Up"); } if (data.player.xp >= 800 && data.player.level < 6) { data.player.level += 1; GameEvents.PlayerLevelUp(data.player.level); StatsGenerator.AssignUnusedPoints(data.player, 10); Debug.Log("Level Up"); } if (data.player.xp >= 1300 && data.player.level < 7) { data.player.level += 1; GameEvents.PlayerLevelUp(data.player.level); StatsGenerator.AssignUnusedPoints(data.player, 10); Debug.Log("Level Up"); } if (data.player.xp >= 2100 && data.player.level < 8) { data.player.level += 1; GameEvents.PlayerLevelUp(data.player.level); StatsGenerator.AssignUnusedPoints(data.player, 10); Debug.Log("Level Up"); } if (data.player.xp >= 3400 && data.player.level < 9) { data.player.level += 1; GameEvents.PlayerLevelUp(data.player.level); StatsGenerator.AssignUnusedPoints(data.player, 10); Debug.Log("Level Up"); } if (data.player.xp >= 5500 && data.player.level < 10) { data.player.level += 1; GameEvents.PlayerLevelUp(data.player.level); StatsGenerator.AssignUnusedPoints(data.player, 10); Debug.Log("Level Up"); } System.IO.File.WriteAllText("xp.txt", System.Convert.ToString(data.player.xp)); System.IO.File.WriteAllText("level.txt", System.Convert.ToString(data.player.level)); }
void LevelUp(int level) { Debug.Log("NPC Level Up!"); myStats.level = level; StatsGenerator.AssignUnusedPoints(myStats, 5); }