示例#1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Font for ASCII graphics
            this.asciiGraphicsFont = this.Content.Load <SpriteFont>("Fonts/BPmono40Bold");
            this.logFont           = this.Content.Load <SpriteFont>("Fonts/Consolas12");

            #region Temporary code

            // Create a map to use for (test) playground.
            this.testMap = new MapContainer(
                MapUtilities.GenerateRandomMap(20, 20, VisualMode.ASCII));
            this.testMap.LoadTileNeighboors();

            // The Actor queue (for the turn system) specific to this map.
            this.queueHelper = new ActorQueueHelper(this.testMap);

            // Initialize VisualEngine for the game
            this.visualEngine = new VisualEngine(
                VisualMode.ASCII,
                32,
                16, 11,
                this.testMap,
                null,
                this.asciiGraphicsFont);
            this.visualEngine.DeltaTileDrawCoordinates = new Point(4, -6);
            this.visualEngine.ASCIIScale = 0.7f;

            // Initialize MessageLog.
            Rectangle logRect = new Rectangle(
                0,
                this.visualEngine.MapDrawboxTileSize.Y * this.visualEngine.TileSize,
                ScreenWidth - 30,
                (ScreenHeight - 30) - (this.visualEngine.MapDrawboxTileSize.Y * this.visualEngine.TileSize));
            this.messageLog = new MessageLog(logRect, this.logFont);

            // Create an actor (unit, character, etc.) for the player.
            this.actor = new Actor(
                "SCiENiDE",
                "@",
                new PropertyBag <int>(),
                this.testMap,
                Flags.IsPlayerControl,
                85,
                Species.Human);

            //// TODO: Improve actor spawn/add to actorQueue.
            // "Spawn" the actor on the map, and add him to the map actor list.
            this.actor.Position = new Point();
            this.queueHelper.AddActor(this.actor);

            #endregion
        }