예제 #1
0
        public ArenaEngineAdapter(ArenaEngine arena)
        {
            Arena = arena;

            var timelines = new List <TimelineInfo>();
            int counter   = 0;

            foreach (var obj in arena.UpdatingObjects)
            {
                bool notFound = true;
                foreach (var tl in timelines)
                {
                    if (tl.Timeline.Name == obj.Name)
                    {
                        notFound = false;
                        break;
                    }
                }
                if (notFound)
                {
                    var tp = new TimelinePrototype(obj.Name, colors[counter++]);
                    var ti = new TimelineInfo
                    {
                        Timeline  = tp,
                        Functions = new BasicFunctionPair(() => Arena.Time,
                                                          () => Arena.GetObjects(obj.Name).Count())
                    };
                    timelines.Add(ti);
                }
            }

            Manager.AddGraph(timelines, "Time (s)", "Population");
        }
예제 #2
0
        public CompleteTurnWriter(string filename, string registryFile, ArenaEngine arena)
        {
            bw = new BinaryWriter(File.Create(filename));

            bw.Write(header);

            bw.Write(arena.Width);
            bw.Write(arena.Height);

            fw = new FileWriter(bw, registryFile, arena.Width, arena.Height);
        }
예제 #3
0
        public ArenaGrid(ArenaEngine arena, int xDivs, int yDivs)
        {
            width  = xDivs;
            height = yDivs;

            grid = new ArenaGridCell[xDivs, yDivs];

            xdiv = arena.Width / xDivs;
            ydiv = arena.Height / yDivs;

            for (int ix = 0; ix < xDivs; ++ix)
            {
                for (int iy = 0; iy < yDivs; ++iy)
                {
                    grid[ix, iy] = new ArenaGridCell();
                }
            }
        }
예제 #4
0
 public ArenaViewer(ArenaEngine arena)
 {
     this.arena = arena;
     InitializeComponent();
 }