コード例 #1
0
 public GameState(Camera camera, int gridSize, ContentManager content)
 {
     mGridSize            = gridSize;
     mCamera              = camera;
     UnitsByPlayer        = new Dictionary <Players, List <IUnit> >();
     SpatialUnitsByPlayer = new SpatialStructuredUnits(mGridSize);
     BuildingsByPlayer    = new Dictionary <Players, List <IUnit> >();
     HeroesByPlayer       = new Dictionary <Players, Hero>();
     UnitsByModel         = new Dictionary <ModelManager.Model, List <IUnit> >();
     Resources            = new Dictionary <Players, Dictionary <Resources, int> >();
     VillagePos           = new Dictionary <Players, Vector2>();
     VillagesByPlayer     = new Dictionary <Players, Village>();
     mMap               = new TileStates[0, 0];
     mPathZones         = new PathFindingZones(0, 0, mGridSize);
     IsPaused           = true;
     mCollision         = new CollisionHandler(gridSize, UnitsByPlayer, IsObstructed);
     mEnemy             = new DummyKi();
     HeroRespawnManager = new HeroRespawnManager();
     mDamageFactor      = new Dictionary <Players, float>();
     foreach (var player in PlayerConstants.sPlayers)
     {
         mDamageFactor.Add(player, 1f);
     }
     mBlockedSound      = new SoundEffectManager(content, "sounds/Logo_miss");
     mStatistics        = new Statistics(content, null, null);
     StatisticsByPlayer = new Dictionary <Players, Dictionary <string, int> >();
     InitStatisticsByPlayer(Players.Player);
     InitStatisticsByPlayer(Players.Ai);
     mPathFinderInstances = new ThreadLocal <PathFinder>(() => new PathFinder(IsObstructed, gridSize));
     mContent             = content;
 }
コード例 #2
0
        public void GenerateEmptyFreeMap(int sizeX, int sizeY)
        {
            mMap = new TileStates[sizeX, sizeY];
            for (var x = 0; x < sizeX; x++)
            {
                for (var y = 0; y < sizeY; y++)
                {
                    mMap[x, y] = TileStates.Free;
                }
            }

            mPathZones = new PathFindingZones(sizeX, sizeY, mGridSize);
        }