private bool HasPossibleCharacterEvent(RoomStats.RoomType room) { for (int i = 0; i < campMan.GetCharacterEvents().Count; i++) { GameObject charEvent = campMan.GetCharacterEvents()[i]; CharacterEvent eventDriver = charEvent.GetComponent <CharacterEvent>(); if (eventDriver.MatchesRoomType(room) && /*&& !eventDriver.playedOnce*/ HasRequiredStats(eventDriver.requiredStats, true)) { return(true); //end function as soon as one is found } } return(false); }
private GameObject RandomizeCharacterEvent(RoomStats.RoomType roomName) { List <GameObject> eligibleEvents = new List <GameObject>(); for (int i = 0; i < campMan.GetCharacterEvents().Count; i++) { CharacterEvent charEvent = campMan.GetCharacterEvents()[i].GetComponent <CharacterEvent>(); if (charEvent.MatchesRoomType(roomName) && /*&& charEvent.playedOnce == false*/ HasRequiredStats(charEvent.requiredStats, true)) { eligibleEvents.Add(campMan.GetCharacterEvents()[i]); } } int randNum = Random.Range(0, eligibleEvents.Count); GameObject thisEvent = eligibleEvents[randNum]; campMan.playedEvents.Add(thisEvent); campMan.charEvents.Remove(thisEvent); //campMan.RemoveFromCharEvents(thisEvent); return(thisEvent); }