/// <summary> /// Add level with id = levelId to list of completed levels /// Save all level data and update game data /// </summary> /// <param name="levelId">id of the level to be completed</param> /// <param name="xpEarned">xp earned in the level</param> /// <param name="goldEarned">gold earned in the level</param> /// <param name="gemsEarned">gems earned in the level</param> /// <param name="stonesCollected">stones collected in the level</param> /// <param name="time">time spent playing the level</param> /// <param name="damageDone">damage done by the player</param> /// <param name="damageTaken">damage done to the player</param> /// <param name="kills">number enemies killed by player</param> /// <param name="hits">total number of hits counted during game session</param> /// <param name="playerLevel">the current level the player has reached</param> public void CompleteLevel(string levelId, int xpEarned, int goldEarned, int gemsEarned, int stonesCollected, float time, float damageDone, float damageTaken, int kills, float hits, int playerLevel, int xpToNext, float shotAccuracy, int score) { if (!LevelList.ContainsKey(levelId)) { return; } if (m_DataStore.CompleteLevel(levelId, LevelList, xpEarned, goldEarned, gemsEarned, stonesCollected, time, damageDone, damageTaken, kills, hits, playerLevel, xpToNext, shotAccuracy, score)) { m_DataStore.UpdateXp(xpEarned); Gold.ChangeCurrency(goldEarned); Gems.ChangeCurrency(gemsEarned); m_DataStore.UpdateEyrieStones(stonesCollected); m_DataStore.UpdateTime(time); m_DataStore.UpdateDamageDone(damageDone); m_DataStore.UpdateDamageTaken(damageTaken); m_DataStore.UpdateEnemiesKilled(kills); m_DataStore.UpdateTotalHits(hits); m_DataStore.UpdateCurrentLevel(playerLevel); m_DataStore.UpdateXpToNextLevel(xpToNext); m_DataStore.UpdateScore(score); } Debug.Log("[CompleteLevel] Saving Data"); SaveData(); }