Esempio n. 1
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            ourGame = ((Game1)(ScreenManager.Game));

            gameFont = content.Load<SpriteFont>("gamefont");

            drawing = new HackNodeGameBoardMedia(ScreenManager.Game, content);
            board = new HackGameBoard((Game1)ScreenManager.Game, this, drawing);

            //USE YOUR CURRENT WAVE TO LOAD UP A NEW MAP.

            board.LoadWave(ourGame);
            player = new HackGameAgent_Player(board);
            board.AddAgent(player);

            int maxtrails = 50;
            float maxAlpha = 0.85f;
            float minAlpha = 0.00f;
            for (int i = 0; i < maxtrails; i++)
            {
                HackGameAgent_Trail t = new HackGameAgent_Trail(board, MathHelper.Lerp(minAlpha, maxAlpha, (float)(maxtrails-i)/maxtrails), drawing.PlayerTexture);
                if (i % 2 != 0 || i < 5)
                {
                    t.SetCurrentState(HackGameAgent.HackGameAgent_State.HackGameAgent_State_Inactive);
                }
                player.AddTrail(t);
                board.AddAgent(t);
            }
            ScreenManager.Game.ResetElapsedTime();

            ourGame.LoadStopTime = DateTime.Now;
            ourGame.LoadTime = (float)(ourGame.LoadStopTime.Ticks - ourGame.LoadStartTime.Ticks) / (float)TimeSpan.TicksPerSecond;
        }