コード例 #1
0
        /// <summary>
        /// Creates the GameMap
        /// </summary>
        /// <returns>Returns the new GameMap</returns>
        public GameMap CreateGameMap()
        {
            map = GameMap.GetInstance();
            map.Initialize(difficulty, mapID, gameType, startingResources, startingLives, mapTiles, strat);

            return map;
        }
コード例 #2
0
 public MapInitializer()
 {
     mapDBController = new MapsDBController();
     mapID = 0;
     difficulty = 0;
     startingResources = 0;
     startingLives = 0;
     mapTiles = new TileType[GRID_WIDTH, GRID_HEIGHT];
     strat = null;
     map = null;
 }
コード例 #3
0
ファイル: GameMap.cs プロジェクト: Wailord/TimeDefender
        /// <summary>
        /// Returns a reference to the GameMap instance. If no instance exists, throws an error.
        /// </summary>
        /// <returns>Returns a reference to the GameMap instance</returns>
        public static GameMap GetInstance()
        {
            GameMap strongReference = (GameMap)_instance.Target;
            if (strongReference == null)
            {
                lock (_lock)
                {
                    if (strongReference == null)
                    {
                        strongReference = new GameMap();
                        _instance = new WeakReference(strongReference);
                    }
                }
            }

            return strongReference;
        }