public InternalBuildingNode GetEntrance(Person person, PassengerBehaviour behaviour) { InternalBuildingNode return_entrance = null; if (entrances.Count == 1) { return(entrances[0]); } for (int i = 0; i < entrances.Count; i++) { if (behaviour.CanVisit(entrances[i])) { // can visit this entrance, return it. // print("returning entrance = " + i); return(entrances[i]); // otherwise continue } } if (return_entrance == null) { print("do not know what entrance to get"); } return(return_entrance); }
public static void SetNeighborsPassengers(Passenger[][] passengers, PassengerBehaviour behaviour) { var rowCount = passengers.Length; var columnCount = passengers.First().Length; for (var i = 0; i < rowCount; i++) { for (var j = 0; j < columnCount; j++) { if (i > 0) { passengers[i][j].AddNeighbor(passengers[i - 1][j]); } if (j > 0) { passengers[i][j].AddNeighbor(passengers[i][j - 1]); } if (i < rowCount - 1) { passengers[i][j].AddNeighbor(passengers[i + 1][j]); } if (j < columnCount - 1) { passengers[i][j].AddNeighbor(passengers[i][j + 1]); } passengers[i][j].PassengerBehaviour = behaviour; } } }
// --------------------------------- FOR PASSENGERS --------------------------------- public PassengerBehaviour VisitBuilding(Person person) { PassengerBehaviour behaviour = new PassengerBehaviour(this, person, passengerBehaviour); InternalBuildingNode entranceNode = GetEntrance(person, behaviour); // print("entrance node = " + entranceNode.position2); behaviour.SetEntrance(entranceNode); return(behaviour); }
/* * public void AssignWorkBuilding(BuildingEmployee building_employee) * { * work_building = building_employee; * * finalDestination = new Vector2(work_building.GetWorkDestination (this).x, work_building.GetWorkDestination (this).z); * steering.Visit (finalDestination); * * state = STATE_MOVING_TO_WORK; * }*/ public void AssignWorkBuilding(BuildingPassenger building_employee) { building = building_employee; behaviour = building.VisitBuilding(this); finalDestination = behaviour.GetEntrancePosition(); steering.Visit(finalDestination); state = STATE_MOVING_TO_WORK; }
/* public void AssignWorkBuilding(BuildingEmployee building_employee) { work_building = building_employee; finalDestination = new Vector2(work_building.GetWorkDestination (this).x, work_building.GetWorkDestination (this).z); steering.Visit (finalDestination); state = STATE_MOVING_TO_WORK; }*/ public void AssignWorkBuilding(BuildingPassenger building_employee) { building = building_employee; behaviour = building.VisitBuilding(this); finalDestination = behaviour.GetEntrancePosition(); steering.Visit(finalDestination); state = STATE_MOVING_TO_WORK; }
public static Passenger CreatePassenger(PassengerBehaviour passengerBehaviour, int number, TransmissionType transmissionType) { var rnd = new Random(); var transport = GetRandomtransportType(); var quality = Math.Round(rnd.NextDouble(), 2); var satisfaction = Math.Round(rnd.NextDouble(), 2); return(new Passenger(passengerBehaviour, transport, transmissionType, quality, satisfaction, number)); }
bool VisitBuilding(string type_name, int _exit_state) { // get building buildingPassenger = (BuildingPassenger)BuildingList.GetPassengerBuilding(this, type_name); if (buildingPassenger == null) { print("could not find building)"); return(false); } else { behaviour = buildingPassenger.VisitBuilding(this); finalDestination = behaviour.GetEntrancePosition(); steering.Visit(finalDestination); state_passenger = STATE_BUILDING_GOTO; buildingExitState = _exit_state; // don't forget to remove eventual message speechBubbleController.RemoveMessageImmediate(this); return(true); } }
public InternalBuildingNode GetEntrance(Person person, PassengerBehaviour behaviour) { InternalBuildingNode return_entrance = null; if (entrances.Count == 1) return entrances[0]; for (int i = 0; i < entrances.Count; i++) { if (behaviour.CanVisit(entrances[i])) { // can visit this entrance, return it. // print("returning entrance = " + i); return entrances[i]; // otherwise continue } } if (return_entrance == null) print("do not know what entrance to get"); return return_entrance; }
// --------------------------------- FOR PASSENGERS --------------------------------- public PassengerBehaviour VisitBuilding(Person person) { PassengerBehaviour behaviour = new PassengerBehaviour(this, person, passengerBehaviour); InternalBuildingNode entranceNode = GetEntrance(person, behaviour); // print("entrance node = " + entranceNode.position2); behaviour.SetEntrance(entranceNode); return behaviour; }
bool VisitBuilding(string type_name, int _exit_state) { // get building buildingPassenger = (BuildingPassenger) BuildingList.GetPassengerBuilding (this, type_name); if (buildingPassenger == null) { print("could not find building)"); return false; } else { behaviour = buildingPassenger.VisitBuilding(this); finalDestination = behaviour.GetEntrancePosition(); steering.Visit(finalDestination); state_passenger = STATE_BUILDING_GOTO; buildingExitState = _exit_state; // don't forget to remove eventual message speechBubbleController.RemoveMessageImmediate(this); return true; } }
public HomeController(PassengerBehaviour passengerBehaviour) { this.passengerBehaviour = passengerBehaviour; }