Inheritance: System.Windows.Controls.Control
Esempio n. 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();
                }
            }
        }
Esempio n. 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];
 }
Esempio n. 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!");
     }
 }
Esempio n. 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;
        }