Exemple #1
0
 public HealthBar(RenderContext context)
 {
     for (int i = 0; i < m_Amount; i++)
     {
         m_Health = new GameSprite("Textures/GUI/Health_GUI",context);
         m_Health.Scale(0.5f);
         m_HealthBar.Add(m_Health);
     }
 }
Exemple #2
0
        public override void Create(RenderContext context)
        {
            m_windParticles = new WindParticleSystem(context, 3);
            m_windParticles.Initialize();
            context.Component.Add(m_windParticles);

            m_WindIndicator = new GameSprite("Textures/Particles/Smoke", context);
            //m_WindIndicator = new GameSprite("Textures/Models/D_Default", context);
        }
Exemple #3
0
        protected override void LoadContent()
        {
            //MENU
            //***************
            m_MenuManager = new MenuManager(m_RenderContext.ViewPortSize / 2);
            m_MenuManager.AddItem(new GUIButton("Textures/GUI/Buttons/StartNormal", "Textures/GUI/Buttons/StartOnHover", ButtonName.Start, m_RenderContext));
            m_MenuManager.AddItem(new GUIButton("Textures/GUI/Buttons/ExitNormal", "Textures/GUI/Buttons/ExitOnHover", ButtonName.Exit, m_RenderContext));
            m_MenuManager.AddItem(new GUIButton("Textures/GUI/Buttons/RestartNormal", "Textures/GUI/Buttons/RestartOnHover", ButtonName.Restart, m_RenderContext));
            m_MenuManager.AddItem(new GUIButton("Textures/GUI/Buttons/ToggleFullscreenNormal", "Textures/GUI/Buttons/ToggleFullscreenOnHover", ButtonName.Fullscreen, m_RenderContext));

            //Set the splash screen and hit screen
            m_MenuManager.BackgroundScreen = new GameSprite("Textures/GUI/BackgroundStartScreen", m_RenderContext);
            m_MenuManager.SplashScreen = new GameSprite("Textures/GUI/DAEScreen_GUI", m_RenderContext);
            m_MenuManager.Initialize(m_RenderContext);

            m_LostMenu = new MenuManager(m_RenderContext.ViewPortSize / 2);
            m_LostMenu.AddItem(new GUIButton("Textures/GUI/Buttons/ExitNormal", "Textures/GUI/Buttons/ExitOnHover", ButtonName.Exit, m_RenderContext));
            m_LostMenu.AddItem(new GUIButton("Textures/GUI/Buttons/RestartNormal", "Textures/GUI/Buttons/RestartOnHover", ButtonName.Restart, m_RenderContext));
            m_LostMenu.Initialize(m_RenderContext);

            //SOUND
            //*****
            SoundManager.AddSound("Background", m_RenderContext);
               // SoundManager.AddSound("ButtonClick", m_RenderContext);

            //POST PROCESSING
            //***************
            m_BloomPP = new BloomPostProcessing(this);
            m_RenderContext.Component.Add(m_BloomPP);

            m_Particles = new WindParticleSystem(m_RenderContext, 7);
               // m_RenderContext.Component.Add(m_Particles);

            //GAMESCENE
            //*********

            MainScene = new GameScene();

            m_Texture = Content.Load<Texture2D>("Textures/Models/D_Default");
            m_Sprite = new GameSprite("Textures/Models/D_Default", m_RenderContext);
            m_Sprite.Scale(0.5f);
        }
Exemple #4
0
       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);
       }