/// <summary> /// Whether a player has an active mission that has the provided id as mission id. /// </summary> /// <param name="id">The id of the mission to find in the mission inventory</param> /// <returns><c>true</c> if the player has an active mission with the given id, <c>false</c> otherwise</returns> public bool HasActive(int id) { lock (Missions) { return(ActiveMissions.Any(m => m.MissionId == id)); } }
private void getActiveMissions() { //check the persistent data folder for the active missions json if (!File.Exists(Application.persistentDataPath + activeMissionsPath)) { //file does not exist //create a new ActiveMissions object this.activeMissions = new ActiveMissions(); //save the current active missions object to storage //eventually move this to some type of saving functionality saveActiveMissions(); } else { //file exists, load text into a string string storedString = File.ReadAllText(Application.persistentDataPath + activeMissionsPath); //deserialize and return the string into an ActiveMissions object this.activeMissions = JsonConvert.DeserializeObject <ActiveMissions>(storedString); } }
public void AddActiveMission(ActiveMission actMiss) { ActiveMissions.Add(actMiss); Messenger <ActiveMission> .Broadcast(EVENT_ACTIVE_MISSION_ADDED, actMiss); }