public Door GetFinishingDoorByTargetBuilding(Door selectedDoor, int targetBuildingId) // TODO: Move this to DoorManager { List <WeightedItem <Door> > doorList = new List <WeightedItem <Door> >(); foreach (var possibleDoor in GetBuilding(targetBuildingId).Doors) { var distance = Vector3.Distance(selectedDoor.transform.position, possibleDoor.transform.position); doorList.Add(new WeightedItem <Door>(possibleDoor, Mathf.Pow(1 / distance, 10))); } return(WeightedItem <Door> .Choose(doorList)); }
public Door GetDoorByTargetBuilding(int startingBuildingId, int targetBuildingId) // TODO: Move this to DoorManager { List <WeightedItem <Door> > doorList = new List <WeightedItem <Door> >(); foreach (var possibleDoor in GetBuilding(startingBuildingId).Doors) { var distance = Vector3.Distance( GetBuilding(targetBuildingId).AveragePosition, possibleDoor.transform.position ); doorList.Add(new WeightedItem <Door>(possibleDoor, 1f / distance)); } return(WeightedItem <Door> .Choose(doorList)); }
void RandomEventRoom() { ClearParagraph(); WeightedItem <int> P50 = new WeightedItem <int>(1, 5); WeightedItem <int> P20 = new WeightedItem <int>(2, 2); WeightedItem <int> P10 = new WeightedItem <int>(3, 1); WeightedItem <int> P1 = new WeightedItem <int>(4, 1); var rerun = Room.CreateContainer("Rerun", () => RandomEventRoom()); List <WeightedItem <int> > myList = new List <WeightedItem <int> > { P50, P20, P10, P1 }; int chosen = WeightedItem <int> .Choose(myList); Run pick = new Run(); if (chosen == 1) { Player.HasKnot = true; pick = Room.CreateRun($"It landed on one! {HasKnot("I will f**k you tonight")}"); } else if (chosen == 2) { Player.HasKnot = false; pick = Room.CreateRun($"It landed on two! {HasKnot("I will f**k you tonight")}"); } else if (chosen == 3) { pick = Room.CreateRun("It landed on three!"); } else if (chosen == 4) { pick = Room.CreateRun("It landed on four!"); } Run stats = Room.CreateRun(GameStats()); AddInline(pick, rerun, "\n\n", stats); }