/// <summary> /// Has the car arrived at its destination? /// </summary> /// <returns>true if arrived, false if still transitioning.</returns> private bool ArrivedDestination() { bool arrived = false; // Are we heading in a direction, but servicing the opposite list (i.e. heading up to service the downList - or vice versa) Direction currentListDirection = (CurrentList == upList) ? Direction.up : Direction.down; if (currentListDirection != CurrentDirection) { // We are servicing opposing list / direction case. We have only arrived if we are at the head of the list. if ((CurrentList.Count > 0) && (CurrentList[0] != CurrentFloor)) { return(arrived); } } if (CurrentList.Contains(CurrentFloor)) { Console.WriteLine("Car is on floor {0}, loading/unloading passengers, and {1}.", CurrentFloor, (CurrentDirection == Direction.idle) ? "is idle" : "is heading " + CurrentDirection.ToString()); Console.WriteLine("You have {0} seconds to choose your destination. Otherwise, you may loose your turn.", ElevatorTimer.TheTimer.Interval / 1000); CurrentList.Remove(CurrentFloor); arrived = true; } return(arrived); }
private void SetEntityList(PrefabEntity entity) { var list = GetList(entity.SectorPosition); list.Add(entity); if (!IsActive) { return; } var active = CurrentList.Contains(entity.SectorPosition); entity.SetActive(active); }
private void SetList(bool active) { var list = active ? CurrentList: PreviousList; for (int i = 0; i < list.Count; i++) { var pos = list[i]; if (active && !PreviousList.Contains(pos)) { SetSector(pos, true); } else if (!active && !CurrentList.Contains(pos)) { SetSector(pos, false); } } }
public void Add(Point3 pos, GameObject go) { GetLevelList(pos).Add(go); go.SetActive(CurrentList.Contains(pos)); }
public bool CurrentContains(T obj) { return(CurrentList.Contains(obj)); }