示例#1
0
 /// <summary>
 /// Creates a new GameMap object
 /// </summary>
 protected GameMap()
 {
     difficulty = 0;
     mapID = 0;
     highscore_controller = null;
     gameType = 0;
     map = null;
     score = null;
 }
示例#2
0
        /// <summary>
        /// Gets the current GameScore instance
        /// </summary>
        /// <returns>Returns an instance of the GameScore object</returns>
        public static GameScore GetInstance()
        {
            GameScore strongReference = (GameScore)_instance.Target;
            if (strongReference == null)
            {
                lock (_lock)
                {
                    if (strongReference == null)
                    {
                        strongReference = new GameScore();
                        _instance = new WeakReference(strongReference);
                    }
                }
            }

            return strongReference;
        }
示例#3
0
        /// <summary>
        /// Sets up the game map with all the map components
        /// </summary>
        /// <param name="diff">The maps difficulty</param>
        /// <param name="ID">The maps ID</param>
        /// <param name="type">The game type</param>
        /// <param name="startRes">The amount of starting resources</param>
        /// <param name="startLives">The amount of starting lives</param>
        /// <param name="mapSet">The array of tiles that are the map</param>
        /// <param name="strat">The strategy to be used to determine the total score calculation and win condition</param>
        public void Initialize(int diff, int ID, int type, int startRes, int startLives, TileType[,] mapTiles, AbstractGameStrategy strat)
        {
            difficulty = diff;
            mapID = ID;

            if (mapID == 0)
                highscore_controller = null;
            else
                highscore_controller = new HighScoresDBController();

            gameType = type;
            map = mapTiles;

            score = GameScore.GetInstance();
            score.Initialize(startingLives, startingResources, strat);
        }