示例#1
0
 public static bool Add(GameField f, int X, int Y, double time)
 {
     f.CheckBorders(ref X, ref Y);
     if (!AddedEvents.Contains(new Point(X, Y)))
     {
         var ev = new ScheduleUpdateEvent(f, X, Y);
         ev.eTime = time;
         DEVS.ModelEvent.Enque(ev);
         AddedEvents.Add(new Point(X, Y));
         return(true);
     }
     return(false);
 }
示例#2
0
        private void NextButton_Click(object sender, EventArgs e)
        {
            if (newCells.Count > 0)
            {
                foreach (var cell in newCells)
                {
                    field.SetCell(cell.X, cell.Y, true);
                    ScheduleUpdateEvent.Add(field, cell.X, cell.Y, DEVS.GlobalTime);
                }
                newCells.Clear();
            }

            field.Swap();

            DeleteEvents.Add(field, DEVS.GlobalTime);

            if (showEvents)
            {
                seenCells.Clear();
            }
            double time = DEVS.GlobalTime;

            while (time == DEVS.GlobalTime && DEVS.ProcessNextEvent())
            {
                if (showEvents)
                {
                    addSeenCell();
                }
            }

            //if (DEVS.EventCount <= 0)
            //{
            //	MessageBox.Show("No events");
            //}

            graphics.Clear();
            drawFrame();
        }
示例#3
0
 void schedule()
 {
     ScheduleUpdateEvent.Add(field, X, Y, DEVS.GlobalTime + 1);
 }