示例#1
0
        public void Draw(SpriteBatch pSpriteBatch, SpriteFont pFont, InterfaceManager pInterfaceManager)
        {
            if (focusOnPlanet == false)
            {
                float   spacing    = 35;
                Vector2 positionUI = new Vector2(15, 35);
                pSpriteBatch.DrawString(pFont, "ID : " + name, positionUI, Color.White);
                positionUI += new Vector2(0, spacing);
                pSpriteBatch.DrawString(pFont, "DISTANCE : " + distance + " LY", positionUI, Color.White);
            }

            principalStar.DrawGlow(pSpriteBatch);
            principalStar.Draw(pSpriteBatch);
            foreach (Planet p in list_planets)
            {
                p.DrawGlow(pSpriteBatch);
            }
            foreach (Planet p in list_planets)
            {
                p.DrawOrbit(pSpriteBatch);
            }
            foreach (Planet p in list_planets)
            {
                p.Draw(pSpriteBatch, pFont, pInterfaceManager);
            }
        }
示例#2
0
        public void Draw(SpriteBatch pSpriteBatch, SpriteFont pFont, InterfaceManager pInterfaceManager)
        {
            pSpriteBatch.DrawCircle(position, radius, 100, color, radius);

            Vector2 positionUI = new Vector2(15, 35);
            float   spacing    = 35;

            if (isClicked && displayHUD)
            {
                pSpriteBatch.DrawCircle(position, radius + 2, 100, Color.Crimson, 2);
                pSpriteBatch.DrawString(pFont, "ID : " + name, positionUI, Color.White);
                positionUI += new Vector2(0, spacing);
                pSpriteBatch.DrawString(pFont, "TYPE : " + type, positionUI, Color.White);
                positionUI += new Vector2(0, spacing);
                pSpriteBatch.DrawString(pFont, "TEMPERATURE : " + temperature, positionUI, Color.White);
                positionUI += new Vector2(0, spacing);
                pSpriteBatch.DrawString(pFont, "WATER : " + haveWater, positionUI, Color.White);
                positionUI += new Vector2(0, spacing);
                if (beforeClicked != isClicked)
                {
                    Color buttonColor;
                    bool  isInteractable;
                    if (haveWater == "yes")
                    {
                        buttonColor    = Color.Green;
                        isInteractable = true;
                    }
                    else
                    {
                        buttonColor    = Color.Red;
                        isInteractable = false;
                    }
                    pInterfaceManager.createButton(pSpriteBatch, positionUI, "Launch", "launch", pFont, "default", buttonColor, isInteractable);
                }
            }
            beforeClicked = isClicked;
        }
 public SystemGenerator()
 {
     list_backgroundStars = new List <Vector2>();
     myInterfaceManager   = new InterfaceManager();
 }
示例#4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch      = new SpriteBatch(GraphicsDevice);
            resolutionFactor = (float)GraphicsDevice.Viewport.Width / 1920;
            //TODO: use this.Content to load your game content here

            myIntroduction = new Introduction();
            myGameover     = new Gameover();
            myWin          = new Win(GraphicsDevice);
            myEnd          = new End();

            myGameState = new GameState();
            myGameState.init("normal");

            mySystemGenerator = new SystemGenerator();
            myRandom          = new Random();

            myInterfaceManager = new InterfaceManager();

            fontDefault = Content.Load <SpriteFont>("defaultFont");
            fontTitle   = Content.Load <SpriteFont>("titleFont");
            fontMenu    = Content.Load <SpriteFont>("menuFont");
            fontIntro   = Content.Load <SpriteFont>("introFont");

            defaultEffect = new BasicEffect(GraphicsDevice);

            // -- LOAD ALL IMAGES
            img_launchPad     = Content.Load <Texture2D>("launchpad");
            img_rocket        = Content.Load <Texture2D>("rocket");
            img_controlpanel  = Content.Load <Texture2D>("controlpanel");
            img_jauge         = Content.Load <Texture2D>("jauge");
            img_ledOn         = Content.Load <Texture2D>("greenlight");
            img_ledOff        = Content.Load <Texture2D>("redlight");
            img_leverOff      = Content.Load <Texture2D>("leverOff");
            img_leverOn       = Content.Load <Texture2D>("leverOn");
            img_switchOff     = Content.Load <Texture2D>("switchOff");
            img_switchOn      = Content.Load <Texture2D>("switchOn");
            img_particleFire  = Content.Load <Texture2D>("particle");
            img_background    = Content.Load <Texture2D>("background");
            img_star          = Content.Load <Texture2D>("star");
            img_jaugeInverted = Content.Load <Texture2D>("jaugeinverted");
            img_fragment1     = Content.Load <Texture2D>("fragment1");
            img_fragment2     = Content.Load <Texture2D>("fragment2");
            img_fragment3     = Content.Load <Texture2D>("fragment3");
            img_fragment4     = Content.Load <Texture2D>("fragment4");
            img_fragment5     = Content.Load <Texture2D>("fragment5");
            img_fragment6     = Content.Load <Texture2D>("fragment6");
            img_fragment7     = Content.Load <Texture2D>("fragment7");
            fragmentArray     = new Texture2D[7];
            fragmentArray[0]  = img_fragment1;
            fragmentArray[1]  = img_fragment2;
            fragmentArray[2]  = img_fragment3;
            fragmentArray[3]  = img_fragment4;
            fragmentArray[4]  = img_fragment5;
            fragmentArray[5]  = img_fragment6;
            fragmentArray[6]  = img_fragment7;
            img_backgroundsky = Content.Load <Texture2D>("backgroundsky");
            img_cursor        = Content.Load <Texture2D>("White");
            MouseCursor.FromTexture2D(img_cursor, 0, 0);
            //-- LOAD ALL SOUNDS
            sound_clic      = Content.Load <SoundEffect>("clic");
            sound_engine    = Content.Load <SoundEffect>("engine");
            sound_refuel    = Content.Load <SoundEffect>("refuel");
            sound_explosion = Content.Load <SoundEffect>("explosion");
            sound_air       = Content.Load <SoundEffect>("air");
            sound_music     = Content.Load <SoundEffect>("music");
            sound_cool      = Content.Load <SoundEffect>("cool");
            sound_key       = Content.Load <SoundEffect>("key");
            sound_alarm     = Content.Load <SoundEffect>("alarm");
            sound_switchOn  = Content.Load <SoundEffect>("sd_switchOn");
            sound_switchOff = Content.Load <SoundEffect>("sd_switchOff");

            sound_refuelInstance         = sound_refuel.CreateInstance();
            sound_airInstance            = sound_air.CreateInstance();
            sound_musicInstance          = sound_music.CreateInstance();
            sound_musicInstance.IsLooped = true;
            sound_coolInstance           = sound_cool.CreateInstance();
            sound_alarmInstance          = sound_alarm.CreateInstance();
            InitMenuInterface();

            panelHeight           = GraphicsDevice.Viewport.Height - img_controlpanel.Height * resolutionFactor;
            myParticleStarManager = new ParticleManager(new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2));

            defaultRocketPosition = new Vector2(GraphicsDevice.Viewport.Width / 2, panelHeight - img_launchPad.Height + 8);
            InitGameplayInterface();
        }
示例#5
0
        public string Draw(SpriteBatch pSpriteBatch, GraphicsDevice pGraphicsDevice, SpriteFont pFont, SpriteFont pOtherFont, SpriteFont pSmallFont, GameState pGameState, InterfaceManager pInterfaceManager)
        {
            myStarManager.Draw(pSpriteBatch);
            string sTitle     = "-MISSION ACCOMPLISHED-";
            string sTotal     = "-" + pGameState.rocketHumansCapacity + " HUMANS";
            string sRemaining = pGameState.rocketArrived + "/" + pGameState.targetRocketArrived + " ROCKETS ARRIVED";
            string sContinue  = "PRESS ENTER TO CONTINUE";

            Vector2 spacing = new Vector2(0, 100);

            Vector2 startPos = new Vector2(pGraphicsDevice.Viewport.Width / 2, (pGraphicsDevice.Viewport.Height / 2) - 200);

            pSpriteBatch.DrawString(pFont, sTitle, startPos, Color.Green * alpha, 0, new Vector2(pFont.MeasureString(sTitle).X / 2, pFont.MeasureString(sTitle).Y / 2), 1f, SpriteEffects.None, 0);

            pSpriteBatch.DrawString(pOtherFont, sTotal, startPos + spacing * 1.5f, Color.White * alpha, 0, new Vector2(pOtherFont.MeasureString(sTotal).X / 2, pOtherFont.MeasureString(sTotal).Y / 2), 1f, SpriteEffects.None, 0);

            pSpriteBatch.DrawString(pOtherFont, sRemaining, startPos + spacing * 2, Color.White * alpha, 0, new Vector2(pOtherFont.MeasureString(sRemaining).X / 2, pOtherFont.MeasureString(sRemaining).Y / 2), 1f, SpriteEffects.None, 0);

            pSpriteBatch.DrawString(pSmallFont, sContinue, startPos + spacing * 3, Color.White * alpha, 0, new Vector2(pSmallFont.MeasureString(sContinue).X / 2, pSmallFont.MeasureString(sContinue).Y / 2), 1f, SpriteEffects.None, 0);

            float radius = 450f;

            pGameState.currentPlanet.position = new Vector2(pGraphicsDevice.Viewport.Width / 2, pGraphicsDevice.Viewport.Height + radius / 1.2f);
            pGameState.currentPlanet.radius   = radius;
            pGameState.currentPlanet.DrawGlow(pSpriteBatch);
            pGameState.currentPlanet.Draw(pSpriteBatch, pFont, pInterfaceManager);
            pGameState.currentPlanet.displayOrbit = false;
            pGameState.currentPlanet.displayHUD   = false;
            if (alpha <= 0)
            {
                return(result);
            }
            else
            {
                return(null);
            }
        }