/** * FUNCTION NAME: OnEnable * DESCRIPTION : Restores difficulty settings from a past game session. * INPUTS : None * OUTPUTS : None **/ public void OnEnable() { if (File.Exists(Application.persistentDataPath + "/difficulty_levels.dat")) { BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Open(Application.persistentDataPath + "/difficulty_levels.dat", FileMode.Open); LPK_DifficultyData data = (LPK_DifficultyData)bf.Deserialize(file); file.Close(); m_eDifficultyLevel = data.m_eDifficultyLevel; } }
/** * FUNCTION NAME: SetDifficultyMedium * DESCRIPTION : Set the difficulty level of the game to be medium. * INPUTS : None * OUTPUTS : None **/ public void SetDifficultyMedium() { m_eDifficultyLevel = LPK_DifficultyLevel.MEDIUM; DispatchEvent(); }
/** * FUNCTION NAME: SetDifficultyHard * DESCRIPTION : Set the difficulty level of the game to be hard. * INPUTS : None * OUTPUTS : None **/ public void SetDifficultyHard() { m_eDifficultyLevel = LPK_DifficultyLevel.HARD; DispatchEvent(); }
/** * FUNCTION NAME: SetDifficultyEasy * DESCRIPTION : Set the difficulty level of the game to be easy. * INPUTS : None * OUTPUTS : None **/ public void SetDifficultyEasy() { m_eDifficultyLevel = LPK_DifficultyLevel.EASY; DispatchEvent(); }