I bought a game template off of the assets store to help speed up my development. I am now stuck however as I want to add a level select screen that locks levels based on progression. I know I want to use playerprefs to do it as it seems to be the most logical way.
So I have already made the level select screen using UI buttons for my levels 1-4 and using raw images to cover up the buttons that are locked. I created a simple java script to be able to disable the raw image game object using if(PlayerPrefs.GetInt(“savedgame1”)==1) changing savedgame for each rawimage.
Now I have the problem of figuring out how to add the key into the game over. The game uses two factions one being a player faction and the other an ai faction. I just do not have the c# knowledge to do this. Here is a snip it from the code in the game controller. player faction id is set to 0 by default. I just need to figure out how to add in a playerprefs key for faction id 0 winning and also a variable that will let me set different levels (a scene identifier) IE. gamesaved1, gamesaved2, gamesaved3 ect for each scene.
public static void GameOver(int factionID){
if(FactionManager.IsPlayerFaction(factionID)){
PerkManager.GainPerkCurrencyOnVictory();
}
if(onGameMessageE!=null) onGameMessageE("GameOver");
gamePhase=_GamePhase.Over;
FactionManager.GameOver();
if(onGameOverE!=null) onGameOverE(factionID);
}