Example #1
0
        public GameState(int width, int height,
                         int turntime, int loadtime,
                         int viewradius2, int attackradius2, int spawnradius2)
        {
            Width  = width;
            Height = height;

            LoadTime = loadtime;
            TurnTime = turntime;

            ViewRadius2   = viewradius2;
            AttackRadius2 = attackradius2;
            SpawnRadius2  = spawnradius2;

            MyAnts     = new List <Ant>();
            MyHills    = new List <AntHill>();
            EnemyAnts  = new List <Ant>();
            EnemyHills = new List <AntHill>();
            DeadTiles  = new List <Location>();
            FoodTiles  = new List <Location>();



            map    = new Tile[width, height];
            coords = Vector2i.GenerateCoords(Vector2i.Zero, new Vector2i(width, height));

            foreach (var coord in coords)
            {
                map[coord.x, coord.y]          = defaultTile;
                map[coord.x, coord.y].position = coord;
            }
        }
Example #2
0
        public static List <Vector2i> GenerateCircle(int radius2)
        {
            int squares = (int)Math.Floor(Math.Sqrt(radius2));

            return(Vector2i.GenerateCoords(
                       new Vector2i(-squares, -squares),
                       new Vector2i(squares + 1, squares + 1),
                       v => (v.x * v.x + v.y * v.y) <= radius2));
        }
Example #3
0
        public TacticalMap(int width, int height, int attackRadius2)
        {
            Width  = width;
            Height = height;

            map    = new Tile[width, height];
            coords = Vector2i.GenerateCoords(Vector2i.Zero, new Vector2i(width, height));

            foreach (var c in coords)
            {
                Tile tile;
                tile.enemies  = new List <EnemyPresence>();
                tile.position = c;
                tile.isLand   = true;
                map[c.x, c.y] = tile;
            }

            stamp = BuildStamp(attackRadius2);
        }
        public ExplorationMap(Configuration config)
        {
            width          = config.width;
            height         = config.height;
            visitDelay     = config.visitDelay;
            enableCritical = -config.noCriticalStartup;
            isVisible      = config.visibilityCheck;

            map    = new Tile[width, height];
            coords = Vector2i.GenerateCoords(Vector2i.Zero, new Vector2i(width, height));

            Tile defaultTile;

            defaultTile.isCritical     = false;
            defaultTile.needsVisit     = false;
            defaultTile.timeSinceVisit = int.MaxValue;

            foreach (var c in coords)
            {
                map[c.x, c.y] = defaultTile;
            }
        }