public Hideout GetRandomHideoutOfType(HideoutType type) { List <Hideout> hideouts = new List <Hideout> (); foreach (var h in Hideouts) { if (h.Type == type) { hideouts.Add(h); } } return(hideouts[Random.Range(0, hideouts.Count)]); }
public List <Node> GetRandomPathToHideout(Node currentNode, Room currentRoom, HideoutType type) { List <Node> hideouts = new List <Node> (); while (hideouts.Count < 3) { Room r = Rooms [Random.Range(0, Rooms.Length)]; if (r == currentRoom) { continue; } Hideout h = r.GetRandomHideoutOfType(type); if (!h.Available || hideouts.Contains(h)) { continue; } hideouts.Add(h); } return(FindPath(currentNode, hideouts[Random.Range(0, 3)])); }