Пример #1
0
        public MyGameGrid(MyStrategy strategy)
        {
            _strategy = strategy;

            _cellCount = Convert.ToInt32(strategy.World.Width) / GameGridDelta;

            Grid = new MyGridCellInfo[_cellCount, _cellCount];

            for (var i = 0; i < _cellCount; i++)
            {
                for (var j = 0; j < _cellCount; j++)
                {
                    Grid[i, j] = new MyGridCellInfo(i, j);
                }
            }
        }
Пример #2
0
 public static double Distance(this MyGridCellInfo cell, MySquad squad)
 {
     return(Math.Sqrt(Math.Pow(cell.X - squad.X, 2) + Math.Pow(cell.Y - squad.Y, 2)));
 }
Пример #3
0
 public static double Distance(this MyGridCellInfo cell, MyGridCellInfo cell2)
 {
     return(Math.Sqrt(Math.Pow(cell.X - cell2.X, 2) + Math.Pow(cell.Y - cell2.Y, 2)));
 }