public void Initialize(RenderContext context) { //Create new savedata file if it doesn't exist yet if (!File.Exists(SaveDataFile)) { SaveData data = new SaveData(); data.HighestDistance = 0; XmlWriter.SaveScore(data, SaveDataFile); } SaveScore(); // actually loads the score isActive = true; m_ViewPort = context.GraphicsDevice.Viewport; //Load a font TextRenderer.SetFont(context.Content.Load <SpriteFont>("Font/Standard")); //Create player an set him at center of screen m_StartPos = new Vector2(context.ViewPortSize.X * 0.25f, context.ViewPortSize.Y * 0.25f); m_Player = new Player(context, m_StartPos); m_Player.Initialize(context); m_Player.Translate(m_StartPos); context.Player = m_Player; //Generate a random level m_LevelManager = new LevelManager(); m_LevelManager.Initialize(context); //AddParalaxing backgrounds m_BgManager = new BackgroundManager(context); m_BgManager.AddBackgound(new Background("background", new Vector2(0, 0), 1.0f, false, context)); m_BgManager.AddBackgound(new Background("1", new Vector2(60, 20), 1.0f, false, context)); m_BgManager.AddBackgound(new Background("2", new Vector2(100, 70), 1, false, context)); m_BgManager.AddBackgound(new Background("3", new Vector2(200, 40), 1, false, context)); m_BgManager.AddBackgound(new Background("4", new Vector2(300, 50), 1, false, context)); m_BgManager.AddBackgound(new Background("5", new Vector2(400, 200), 1, false, context)); #if (DEBUG) m_MonoDebug = new DebugViewXNA(context.World); m_MonoDebug.AppendFlags(DebugViewFlags.DebugPanel); m_MonoDebug.DefaultShapeColor = Color.Red; m_MonoDebug.SleepingShapeColor = Color.LightGray; m_MonoDebug.LoadContent(context.GraphicsDevice, context.Content); #endif SoundManager.Play("Background", true); HitScreen = new GameSprite("Textures/GUI/hit", context); PickScreen = new GameSprite("Textures/GUI/pickupHit", context); }
public void Initialize(RenderContext context) { //Create new savedata file if it doesn't exist yet if (!File.Exists(SaveDataFile)) { SaveData data = new SaveData(); data.HighestDistance = 0; XmlWriter.SaveScore(data, SaveDataFile); } SaveScore(); // actually loads the score isActive = true; m_ViewPort = context.GraphicsDevice.Viewport; //Load a font TextRenderer.SetFont(context.Content.Load<SpriteFont>("Font/Standard")); //Create player an set him at center of screen m_StartPos = new Vector2(context.ViewPortSize.X * 0.25f, context.ViewPortSize.Y * 0.25f); m_Player = new Player(context, m_StartPos); m_Player.Initialize(context); m_Player.Translate(m_StartPos); context.Player = m_Player; //Generate a random level m_LevelManager = new LevelManager(); m_LevelManager.Initialize(context); //AddParalaxing backgrounds m_BgManager = new BackgroundManager(context); m_BgManager.AddBackgound(new Background("background", new Vector2(0, 0), 1.0f, false, context)); m_BgManager.AddBackgound(new Background("1", new Vector2(60, 20), 1.0f, false, context)); m_BgManager.AddBackgound(new Background("2", new Vector2(100, 70), 1, false, context)); m_BgManager.AddBackgound(new Background("3", new Vector2(200, 40), 1, false, context)); m_BgManager.AddBackgound(new Background("4", new Vector2(300, 50), 1, false, context)); m_BgManager.AddBackgound(new Background("5", new Vector2(400, 200), 1, false, context)); #if(DEBUG) m_MonoDebug = new DebugViewXNA(context.World); m_MonoDebug.AppendFlags(DebugViewFlags.DebugPanel); m_MonoDebug.DefaultShapeColor = Color.Red; m_MonoDebug.SleepingShapeColor = Color.LightGray; m_MonoDebug.LoadContent(context.GraphicsDevice, context.Content); #endif SoundManager.Play("Background", true); HitScreen = new GameSprite("Textures/GUI/hit", context); PickScreen = new GameSprite("Textures/GUI/pickupHit", context); }