Inheritance: System.Windows.Controls.Control
Beispiel #1
0
        public void SendPersonTo(Stall stall)
        {
            if (this.selection != null) {

                if (this.selection.CanUseStall(stall)) {

                    this.selection.GoToStall(stall);
                    this.Deselect(this.selection);

                    this.UpdateWaitingLine();
                }
            }
        }
Beispiel #2
0
 public IEnumerable<Stall> GetNeighbors(Stall stall)
 {
     int stallIndex = this.stalls.IndexOf(stall);
     if (stallIndex > 0)
         yield return this.stalls[stallIndex - 1];
     if (stallIndex < this.stalls.Count - 1)
         yield return this.stalls[stallIndex + 1];
 }
Beispiel #3
0
 public void ScoreStallChoice(Stall stall)
 {
     int neighbors = this.GetNeighborCount(stall);
     if (neighbors > 0)
     {
         this.AdjustScore(neighbors * (-15));
         stall.Alert(neighbors * (-15), "Pee foul!");
     }
 }
Beispiel #4
0
        public int GetNeighborCount(Stall stall)
        {
            int stallIndex = this.stalls.IndexOf(stall);
            int neighbors = 0;
            if (stallIndex > 0 && this.stalls[stallIndex - 1].Person != null)
                ++neighbors;
            if (stallIndex < this.stalls.Count - 1 && this.stalls[stallIndex + 1].Person != null)
                ++neighbors;

            return neighbors;
        }