Exemplo n.º 1
0
        public MoleculeAnalyzer(HexGrid grid, MoleculeType type)
        {
            m_grid = grid;
            m_type = type;

            // Work out how many complete cells we can fit vertically
            var bounds   = grid.GetVisibleCells();
            int tileSize = (bounds.Max.Y - bounds.Min.Y) / 2 - 1;

            m_tiling = new HexTiling(Math.Min(MaxTileSize, tileSize));

            m_atomFinder = new AtomFinder(grid);
        }
Exemplo n.º 2
0
        private void CreateBase(int x, int y, bool isPlayer, IDictionary <IHexGridCell, bool> baseTerrains)
        {
            IHexGridCell centerBaseTile = HexTiling[x, y];

            centerBaseTile.RemoveComponent <CreepComponent>();
            centerBaseTile.AddComponent((isPlayer) ? (new PlayerBaseComponent() as ICellComponent) : new EnemyBaseComponent());
            baseTerrains.Add(centerBaseTile, isPlayer);
            foreach (IHexGridCell neighbor in HexTiling.CellNeighbors(centerBaseTile))
            {
                baseTerrains.Add(neighbor, isPlayer);
                neighbor.RemoveComponent <CreepComponent>();
            }
            if (isPlayer)
            {
                PlayerBase = centerBaseTile;
            }
            else
            {
                EnemyBase = centerBaseTile;
            }
        }