Exemple #1
0
        /// <summary>
        /// The main game constructor.
        /// </summary>
        public GameStateManagementGame()
        {
            Content.RootDirectory = "Content";

            graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferWidth  = 1080;
            graphics.PreferredBackBufferHeight = 600;

            // Create the screen manager component.
            screenManager = new ScreenManager(this);

            Components.Add(screenManager);

            // Activate the first screens.
            screenManager.AddScreen(new BackgroundScreen(), null);
            screenManager.AddScreen(new MainMenuScreen(), null);

            graphics.IsFullScreen = false;
            graphics.ApplyChanges();
            Window.Title = "Riemer's XNA Tutorials -- Series 1";

            base.Initialize();
        }
Exemple #2
0
        public AOA()
            : base("AOA", new Size(220, 452))
        {
            _aoaNeedle      = new GaugeNeedle("{Helios}/Gauges/F-16/AOA/aoa_tape.xaml", new Point(110, 226), new Size(130, 1482), new Point(65, 741));
            _aoaNeedle.Clip = new RectangleGeometry(new Rect(55d, 86d, 130d, 280d));
            Components.Add(_aoaNeedle);

            _offFlagImage          = new GaugeImage("{Helios}/Gauges/F-16/AOA/aoa_off_flag.xaml", new Rect(55d, 84d, 110d, 282d));
            _offFlagImage.IsHidden = true;
            Components.Add(_offFlagImage);

            Components.Add(new GaugeImage("{Helios}/Gauges/F-16/AOA/aoa_faceplate.xaml", new Rect(0, 0, 220, 452)));

            Components.Add(new GaugeImage("{Helios}/Gauges/F-16/AOA/aoa_bezel.png", new Rect(0, 0, 220, 452)));

            _offFlag          = new HeliosValue(this, new BindingValue(false), "", "off flag", "Indicates whether the off flag is displayed.", "True if displayed.", BindingValueUnits.Boolean);
            _offFlag.Execute += new HeliosActionHandler(OffFlag_Execute);
            Actions.Add(_offFlag);

            _angleOfAttack          = new HeliosValue(this, new BindingValue(0d), "", "angle of attack", "Current angle of attack", "", BindingValueUnits.Degrees);
            _angleOfAttack.Execute += new HeliosActionHandler(AngleOfAttack_Execute);
            Actions.Add(_angleOfAttack);
            Values.Add(_angleOfAttack);
        }
        public BarometricAltimeter()
            : base("Barometric Altimeter", new Size(340, 340))
        {
            Point center = new Point(170, 170);

            _qfeCalibration    = new CalibrationPointCollectionDouble(600d, 0d, 800d, 300d);
            _needleCalibration = new CalibrationPointCollectionDouble(0d, 0d, 10d, 360d);

            _qfeCard = new GaugeNeedle("{Helios}/Gauges/KA-50/BaroAltimeter/baro_alt_qfe_card.xaml", center, new Size(264, 264), new Point(132, 132), 300d);
            Components.Add(_qfeCard);

            Components.Add(new GaugeImage("{Helios}/Gauges/KA-50/BaroAltimeter/baro_alt_faceplate.xaml", new Rect(0, 0, 340, 340)));

            _shortNeedle = new GaugeNeedle("{Helios}/Gauges/KA-50/BaroAltimeter/baro_alt_short_needle.xaml", center, new Size(35, 144), new Point(17.5, 104));
            Components.Add(_shortNeedle);

            _longNeedle = new GaugeNeedle("{Helios}/Gauges/KA-50/BaroAltimeter/baro_alt_long_needle.xaml", center, new Size(40, 209), new Point(20, 139));
            Components.Add(_longNeedle);

            _altitudeBug = new GaugeNeedle("{Helios}/Gauges/KA-50/BaroAltimeter/baro_alt_bug.xaml", center, new Size(14, 15), new Point(7, 150));
            Components.Add(_altitudeBug);

            Components.Add(new GaugeImage("{Helios}/Gauges/KA-50/BaroAltimeter/baro_alt_bezel.xaml", new Rect(0, 0, 340, 340)));

            _altitude          = new HeliosValue(this, BindingValue.Empty, "", "Altitude", "Current barometric altitude", "", BindingValueUnits.Meters);
            _altitude.Execute += Altitude_Execute;
            Actions.Add(_altitude);

            _commandedAltitude          = new HeliosValue(this, BindingValue.Empty, "", "Commanded Altitude", "Current commanded altitude", "", BindingValueUnits.Meters);
            _commandedAltitude.Execute += CommandedAltitude_Execute;
            Actions.Add(_commandedAltitude);

            _qfePressure          = new HeliosValue(this, BindingValue.Empty, "", "QFE Pressure", "Current calibrated qfe pressure", "", BindingValueUnits.MilimetersOfMercury);
            _qfePressure.Execute += Pressure_Execute;
            Actions.Add(_qfePressure);
        }
        public FarseerPhysicsGame()
        {
            Window.Title = "Farseer Physics Engine Samples Framework";
            _graphics    = new GraphicsDeviceManager(this);

            _graphics.SynchronizeWithVerticalRetrace = false;
            _graphics.PreferMultiSampling            = true;
            IsFixedTimeStep = true;

#if WINDOWS
            _graphics.PreferredBackBufferWidth  = 1024;
            _graphics.PreferredBackBufferHeight = 768;
            _graphics.IsFullScreen = false;
#endif
#if WINDOWS_PHONE
            _graphics.PreferredBackBufferWidth  = 800;
            _graphics.PreferredBackBufferHeight = 480;
            _graphics.IsFullScreen = true;
            IsFixedTimeStep        = false;
#endif
#if XBOX
            _graphics.PreferredBackBufferWidth  = 1280;
            _graphics.PreferredBackBufferHeight = 720;
            _graphics.IsFullScreen = true;
#endif
            Content.RootDirectory = "Content";
            IsMouseVisible        = true;

            //new-up components and add to Game.Components
            ScreenManager = new ScreenManager(this);
            Components.Add(ScreenManager);

            FrameRateCounter frameRateCounter = new FrameRateCounter(ScreenManager);
            frameRateCounter.DrawOrder = 101;
            Components.Add(frameRateCounter);
        }
        public Game1()
        {
            _graphics       = new GraphicsDeviceManager(this);
            ScreenRectangle = new Rectangle(
                0,
                0,
                ScreenWidth,
                ScreenHeight);

            Content.RootDirectory = "Content";

            Components.Add(new InputHandler(this));

            _gameStateManager = new GameStateManager(this);
            Components.Add(_gameStateManager);

            TitleScreen              = new TitleScreen(this, _gameStateManager);
            StartMenuScreen          = new StartMenuScreen(this, _gameStateManager);
            GamePlayScreen           = new GamePlayScreen(this, _gameStateManager);
            CharacterGeneratorScreen = new CharacterGeneratorScreen(this, _gameStateManager);
            SkillScreen              = new SkillScreen(this, _gameStateManager);

            _gameStateManager.ChangeState(TitleScreen);
        }
Exemple #6
0
        /// <summary>
        /// The main game constructor.
        /// </summary>
        public SquareosityGame()
        {
            Content.RootDirectory = "Content";


            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferHeight = 768;
            graphics.PreferredBackBufferWidth  = 1024;
            TargetElapsedTime = TimeSpan.FromTicks(333333);

            Mouse.WindowHandle = Window.Handle;

            // Create the screen factory and add it to the Services
            screenFactory = new ScreenFactory();
            Services.AddService(typeof(IScreenFactory), screenFactory);

            // Create the screen manager component.
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);


            // On Windows and Xbox we just add the initial screens
            AddInitialScreens();
        }
Exemple #7
0
        public AlienShooterGame()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            TargetElapsedTime     = TimeSpan.FromTicks(333333);

            // you can choose whether you want a landscape or portrait
            // game by using one of the two helper functions defined below
            InitializePortraitGraphics();
            // InitializeLandscapeGraphics();

            // Create the screen manager component.
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            //Add Explosions and Smoke Game Components to AlienShooter
            explosionSmokeParticleSystem = new ExplosionSmokeParticleSystem(this, 2);
            Components.Add(explosionSmokeParticleSystem);
            explosionParticleSystem = new ExplosionParticleSystem(this, 1);
            Components.Add(explosionParticleSystem);
            smokePlumeParticleSystem = new SmokePlumeParticleSystem(this, 8);
            Components.Add(smokePlumeParticleSystem);

            // attempt to deserialize the screen manager from disk. if that
            // fails, we add our default screens.
            if (!screenManager.DeserializeState())
            {
                // Activate the first screens.
                screenManager.AddScreen(new BackgroundScreen(), null);
                screenManager.AddScreen(new MainMenuScreen(), null);
            }
            //Imeplement tombstoning support globally if managing
            //multiple state objects across game gamescreens
            PhoneApplicationService.Current.Activated   += AlienGame_Activated;
            PhoneApplicationService.Current.Deactivated += AlienGame_Deactivated;
        }
Exemple #8
0
        protected void FixSingleInventory()
        {
            MyInventoryBase inventoryBase;

            if (!Components.TryGet <MyInventoryBase>(out inventoryBase))
            {
                return;
            }
            MyInventoryAggregate aggregate     = inventoryBase as MyInventoryAggregate;
            MyInventory          bestInventory = null;

            if (aggregate != null)
            {
                foreach (var inventory in aggregate.ChildList.Reader)
                {
                    var myInventory = inventory as MyInventory;
                    if (myInventory == null)
                    {
                        continue;
                    }
                    if (bestInventory == null)
                    {
                        bestInventory = myInventory;
                    }
                    else if (bestInventory.GetItemsCount() < myInventory.GetItemsCount())
                    {
                        bestInventory = myInventory;
                    }
                }
            }
            if (bestInventory != null)
            {
                Components.Remove <MyInventoryBase>();
                Components.Add <MyInventoryBase>(bestInventory);
            }
        }
        /// <param name="sizeX">Number of X values</param>
        /// <param name="sizeY">Number of Y values</param>
        /// <param name="deltaX">StepSize in X</param>
        /// <param name="deltaY">StepSize in Y</param>
        public RegularGridCoverage(int sizeX, int sizeY, double deltaX, double deltaY, double offSetX, double offSetY, Type componentValueType)
        {
            this.Name = "Regular_Grid";
            var y = new Variable <double>("y", sizeY)
            {
                InterpolationType = InterpolationType.Constant
            };

            y.Attributes[StandardName] = StandardNameY;
            Arguments.Add(y);

            var x = new Variable <double>("x", sizeX)
            {
                InterpolationType = InterpolationType.Constant
            };

            x.Attributes[StandardName] = StandardNameX;
            Arguments.Add(x);


            //Arguments.CollectionChanged += RegularGrid_Arguments_CollectionChanged;

            //Components.CollectionChanged += RegularGrid_Components_CollectionChanged;

            var component = (IVariable)TypeUtils.CreateGeneric(typeof(Variable <>), componentValueType, "value");

            Components.Add(component);

            CollectionChanged += RegularGridCoverage_CollectionChanged;
            ValuesChanged     += RegularGridCoverage_ValuesChanged;



            // update sizes of the arguments
            Resize(sizeX, sizeY, deltaX, deltaY, new Coordinate(offSetX, offSetY));
        }
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            _controlPanel = new ControlPanel(this);
            Components.Add(_controlPanel);

            base.Initialize();

            //Set window defaults. Parent game can override in constructor
            Window.AllowUserResizing  = true;
            Window.ClientSizeChanged += WindowClientSizeChanged;


            //Default projection and view
            ResetCamera();

            _testCount = 0;
            while (TestEntries.TestList[_testCount].CreateTest != null)
            {
                ++_testCount;
            }

            _testIndex = MathUtils.Clamp(_testIndex, 0, _testCount - 1);
            StartTest(_testIndex);
        }
        protected override void Update(GameTime gameTime)
        {
            if (_batchNumber < NumberOfBatches &&
                gameTime.TotalGameTime >= TimeSpan.FromSeconds(_batchNumber))
            {
                for (int i = 0; i < ItemsPerBatch; ++i)
                {
                    var updateable = new TestUpdateable(this);
                    _updateables.Add(updateable);
                    Components.Add(updateable);

                    var drawable = new TestDrawable(this);
                    _drawables.Add(drawable);
                    Components.Add(drawable);
                }

                _batchNumber++;
            }


            base.Update(gameTime);
            _updateablesOrderedCorrectly = ListsEqual(_updateables, _updateablesInUpdateOrder);
            _updateablesInUpdateOrder.Clear();
        }
Exemple #12
0
        /// <summary>
        /// Adds components to the kernel during startup.
        /// </summary>
        protected override void AddComponents()
        {
            Components.Add <IPlanner, Planner>();
            Components.Add <IPlanningStrategy, ConstructorReflectionStrategy>();
            Components.Add <IPlanningStrategy, PropertyReflectionStrategy>();
            Components.Add <IPlanningStrategy, MethodReflectionStrategy>();

            Components.Add <ISelector, Selector>();
            Components.Add <IConstructorScorer, StandardConstructorScorer>();
            Components.Add <IInjectionHeuristic, StandardInjectionHeuristic>();

            Components.Add <IPipeline, Pipeline>();
            Components.Add <IActivationStrategy, PropertyInjectionStrategy>();
            Components.Add <IActivationStrategy, MethodInjectionStrategy>();
            Components.Add <IActivationStrategy, InitializableStrategy>();
            Components.Add <IActivationStrategy, StartableStrategy>();
            Components.Add <IActivationStrategy, BindingActionStrategy>();
            Components.Add <IActivationStrategy, DisposableStrategy>();

                        #if !NO_LCG
            if (!Settings.UseReflectionBasedInjection)
            {
                Components.Add <IInjectorFactory, DynamicMethodInjectorFactory>();
            }
            else
                        #endif
            Components.Add <IInjectorFactory, ReflectionInjectorFactory>();

            Components.Add <ICache, Cache>();
            Components.Add <ICachePruner, GarbageCollectionCachePruner>();

                        #if !NO_ASSEMBLY_SCANNING
            Components.Add <IModuleLoader, ModuleLoader>();
            Components.Add <IModuleLoaderPlugin, CompiledModuleLoaderPlugin>();
                        #endif
        }
Exemple #13
0
        /// <summary>
        /// The main game constructor.
        /// </summary>
        public Game1()
        {
            Content.RootDirectory = "Content";

            graphics          = new GraphicsDeviceManager(this);
            TargetElapsedTime = TimeSpan.FromTicks(333333);

#if WINDOWS_PHONE
            graphics.IsFullScreen = true;

            // Choose whether you want a landscape or portait game by using one of the two helper functions.
            //InitializeLandscapeGraphics();
            InitializePortraitGraphics();
#endif

            // Create the screen factory and add it to the Services
            screenFactory = new ScreenFactory();
            Services.AddService(typeof(IScreenFactory), screenFactory);

            // Create the screen manager component.
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

#if WINDOWS_PHONE
            // Hook events on the PhoneApplicationService so we're notified of the application's life cycle
            Microsoft.Phone.Shell.PhoneApplicationService.Current.Launching +=
                new EventHandler <Microsoft.Phone.Shell.LaunchingEventArgs>(GameLaunching);
            Microsoft.Phone.Shell.PhoneApplicationService.Current.Activated +=
                new EventHandler <Microsoft.Phone.Shell.ActivatedEventArgs>(GameActivated);
            Microsoft.Phone.Shell.PhoneApplicationService.Current.Deactivated +=
                new EventHandler <Microsoft.Phone.Shell.DeactivatedEventArgs>(GameDeactivated);
#else
            // On Windows and Xbox we just add the initial screens
            AddInitialScreens();
#endif
        }
Exemple #14
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            World      = Matrix.Identity;
            View       = Matrix.CreateLookAt(new Vector3(0, 5, -5), Vector3.Zero, Vector3.Up);
            Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, graphics.PreferredBackBufferWidth / (float)graphics.PreferredBackBufferHeight, 0.01f, 100f);

            Debug.GS = new GearConsole(this);
            Debug.GS.Initialize();
            IsMouseVisible = true;

            Debug.GS.Inspect("A hero", new Heroe());

            testers.Add(new TesterLabels(this));

            foreach (Tester tester in testers)
            {
                tester.Enabled = tester.Visible = false;
                Components.Add(tester);
            }

            testers[0].Enabled = testers[0].Visible = true;

            base.Initialize();
        }
Exemple #15
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            KeyboardState = Keyboard.GetState();
            MouseState    = Mouse.GetState();
            // Allows the game to exit
            if (KeyboardState.IsKeyDown(Keys.Escape))
            {
                Exit();
                return;
            }
            //Update the camera.
            Camera.Update((float)gameTime.ElapsedGameTime.TotalSeconds);

            if (MouseState.LeftButton == ButtonState.Pressed)
            {
                //If the user is clicking, start firing some boxes.
                //First, create a new dynamic box at the camera's location.
                Box toAdd = new Box(Camera.Position, 1, 1, 1, 1);
                //Set the velocity of the new box to fly in the direction the camera is pointing.
                //Entities have a whole bunch of properties that can be read from and written to.
                //Try looking around in the entity's available properties to get an idea of what is available.
                toAdd.LinearVelocity = Camera.WorldMatrix.Forward * 10;
                //Add the new box to the simulation.
                space.Add(toAdd);

                //Add a graphical representation of the box to the drawable game components.
                EntityModel model = new EntityModel(toAdd, CubeModel, Matrix.Identity, this);
                Components.Add(model);
                toAdd.Tag = model;  //set the object tag of this entity to the model so that it's easy to delete the graphics component later if the entity is removed.
            }

            //Steps the simulation forward one time step.
            space.Update();

            base.Update(gameTime);
        }
Exemple #16
0
        public Game1()
        {
            _graphics = new GraphicsDeviceManager(this);
            _graphics.PreferredBackBufferWidth  = screenWidth;
            _graphics.PreferredBackBufferHeight = screenHeight;
            _graphics.IsFullScreen = false;
            ScreenRectangle        = new Rectangle(
                0,
                0,
                screenWidth,
                screenHeight);

            _graphics.ApplyChanges();
            Content.RootDirectory = "Content";
            Components.Add(new InputHandler(this));

            _gameStateManager = new GameStateManager(this);
            Components.Add(_gameStateManager);
            TitleScreen = new TitleScreen(this, _gameStateManager);
            //StartMenuScreen = new StartMenuScreen(this, _gameStateManager);
            GridScreen = new GridScreen(this, _gameStateManager);
            _gameStateManager.ChangeState(TitleScreen);
            //_gameStateManager.ChangeState(GridScreen);
        }
Exemple #17
0
        // Constructor
        public Game06()
        {
            musicControl = new MusicControl();


            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            // Make the game object.  The game is currently called 'DuckSlaughterGame'.

            deterministicGame = new DuckSlaughterGame();

            // Debugging setup

            lastPressedKeys = new List <Keys>();
            activePlayer    = playerIdentifiers[0];
            paused          = false;
            gameStarted     = false;


            //Added
            Components.Add(new GamerServicesComponent(this));
            isHost        = false;
            chatText      = "";
            reader        = new PacketReader();
            writer        = new PacketWriter();
            chatlines     = 0;
            isChatting    = false;
            mouseChange   = false;
            buttonPressed = false;
            others        = new player[4];
            update        = true;

            inMenu       = true;
            releasedKeys = new List <Keys>();
        }
Exemple #18
0
        /// <summary>
        /// Constructs a new NetRumbleGame object.
        /// </summary>
        public NetRumbleGame()
        {
            // initialize the graphics device manager
            graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferWidth  = 1280;
            graphics.PreferredBackBufferHeight = 720;

            // initialize the content manager
            Content.RootDirectory = "Content";

            // initialize the gamer-services component
            //   this component enables Live sign-in functionality
            //   and updates the Gamer.SignedInGamers collection.
            Components.Add(new GamerServicesComponent(this));

            // initialize the screen manager
            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            // initialize the audio system
            //AudioManager.Initialize(this, new DirectoryInfo(Content.RootDirectory + @"\audio\wav"));
            AudioManager.Initialize(this, new DirectoryInfo(Path.Combine(Content.RootDirectory, @"Audio/wav")));
        }
Exemple #19
0
        public Battery()
            : base("voltage", new Size(300, 300))
        {
            Components.Add(new GaugeImage("{Helios}/Gauges/FA-18C/Battery/Battery_Faceplate.png", new Rect(0d, 0d, 300d, 300d)));
            _needleU = new GaugeNeedle("{Helios}/Gauges/AV-8B/Common/needle_a.xaml", new Point(150d, 150d), new Size(36, 154), new Point(18, 136), -180d);
            _needleE = new GaugeNeedle("{Helios}/Gauges/AV-8B/Common/needle_a.xaml", new Point(150d, 150d), new Size(36, 154), new Point(18, 136), 180d);
            Components.Add(_needleU);
            Components.Add(_needleE);
            Components.Add(new GaugeImage("{Helios}/Gauges/FA-18C/Battery/Battery_Needle_Cover.png", new Rect(118d, 115d, 62d, 162d)));

            //Components.Add(new GaugeImage("{Helios}/Gauges/A-10/Common/gauge_bezel.png", new Rect(0d, 0d, 364d, 376d)));

            _voltageU          = new HeliosValue(this, new BindingValue(0d), "", "Battery Voltage U", "This is the voltage of the battery in volts", "(16 to 30)", BindingValueUnits.Volts);
            _voltageU.Execute += new HeliosActionHandler(voltageU_Execute);
            Actions.Add(_voltageU);
            _voltageE          = new HeliosValue(this, new BindingValue(0d), "", "Battery Voltage E", "This is the voltage of the battery in volts", "(16 to 30)", BindingValueUnits.Volts);
            _voltageE.Execute += new HeliosActionHandler(voltageE_Execute);
            Actions.Add(_voltageE);

            _calibrationPointsU = new CalibrationPointCollectionDouble(16d, 30d, 30d, 150d);
            _calibrationPointsU.Add(new CalibrationPointDouble(15d, 30d));  // used to set an end stop at 16v
            _calibrationPointsE = new CalibrationPointCollectionDouble(16d, -30d, 30d, -150d);
            _calibrationPointsE.Add(new CalibrationPointDouble(15d, -30d)); // used to set an end stop at 16v
        }
Exemple #20
0
        public IAS()
            : base("IAS", new Size(340, 340))
        {
            Point center = new Point(170, 170);

            _needleCalibration = new CalibrationPointCollectionDouble(20d, 5d, 35d, 345d);
            _needleCalibration.Add(new CalibrationPointDouble(50d, 95d));
            _needleCalibration.Add(new CalibrationPointDouble(100d, 145d));
            _needleCalibration.Add(new CalibrationPointDouble(150d, 185d));
            _needleCalibration.Add(new CalibrationPointDouble(200d, 225d));
            _needleCalibration.Add(new CalibrationPointDouble(250d, 265d));
            _needleCalibration.Add(new CalibrationPointDouble(300d, 305d));

            Components.Add(new GaugeImage("{Helios}/Gauges/KA-50/IAS/ias_faceplate.xaml", new Rect(0, 0, 340, 340)));

            _needle = new GaugeNeedle("{Helios}/Gauges/KA-50/IAS/ias_needle.xaml", center, new Size(40, 159), new Point(20, 139), 5d);
            Components.Add(_needle);

            Components.Add(new GaugeImage("{Helios}/Gauges/KA-50/IAS/ias_bezel.xaml", new Rect(0, 0, 340, 340)));

            _speed          = new HeliosValue(this, BindingValue.Empty, "", "Indicated Airspeed", "Current indicated airspeed", "", BindingValueUnits.KilometersPerHour);
            _speed.Execute += Speed_Execute;
            Actions.Add(_speed);
        }
Exemple #21
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            IsMouseVisible = true;

            spriteBatch = new SpriteBatch(GraphicsDevice);

            SoundManager.Getinstance().Initialize();

            hero = new Hero.Hero(new Vector2(WindowsManager.GetInstance().ScreenWidth / 2, WindowsManager.GetInstance().ScreenHeight / 2), 120, 140, new Vector2(5, 5), 0.0f, new Vector2(0, 0), new Vector2(1, 1), Color.White, true);
            hero.InitWeapon();


            camera = new Camera2D(this, hero);
            Components.Add(camera);

            uiComponent = new Component.HeroUIDrawComponent(this, spriteBatch);
            Components.Add(uiComponent);
            bossuiComponent = new Component.BossUIComponent(this, spriteBatch);
            Components.Add(bossuiComponent);
            //debugmanager = new DebugManager(this, spriteBatch);
            //Components.Add(debugmanager);
            base.Initialize();
        }
Exemple #22
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);

            // TODO: use this.Content to load your game content here

            //create all scenes and add to the Components list
            startScene = new StartScene(this, spriteBatch);
            Components.Add(startScene);

            helpScene = new HelpScene(this, spriteBatch);
            Components.Add(helpScene);

            actionScene1 = new ActionScene1(this, spriteBatch);
            Components.Add(actionScene1);

            actionScene2 = new ActionScene2(this, spriteBatch);
            Components.Add(actionScene2);

            aboutScene = new AboutScene(this, spriteBatch);
            Components.Add(aboutScene);

            howToScene = new HowToScene(this, spriteBatch);
            Components.Add(howToScene);

            pauseScene = new PauseScene(this, spriteBatch);
            Components.Add(pauseScene);

            endScene = new EndScene(this, spriteBatch);
            Components.Add(endScene);


            startScene.show();
            //----------------creating scenes ends------------------------------
        }
Exemple #23
0
        public TunnelVision()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            input = new InputHandler(this);
            Components.Add(input);

            Camera = new TunnelVisionCamera(this);
            Components.Add(Camera);
            Camera.UpdateInput = false;

            gameManager = new GameStateManager(this);
            Components.Add(gameManager);

            Skybox = new Skybox(this);
            Components.Add(Skybox);

            //Components.Add(new GamerServicesComponent(this));

            //Sound = new SoundManager(this, "TunnelVision");

            TitleIntroState  = new TitleIntroState(this);
            StartMenuState   = new StartMenuState(this);
            OptionsMenuState = new OptionsMenuState(this);
            PlayingState     = new PlayingState(this);
            StartLevelState  = new StartLevelState(this);
            FadingState      = new FadingState(this);
            LostGameState    = new LostGameState(this);
            WonGameState     = new WonGameState(this);
            PausedState      = new PausedState(this);
            YesNoDialogState = new YesNoDialogState(this);
            //HighScoresState = new HighScoresState(this);

            gameManager.ChangeState(TitleIntroState.Value);
        }
Exemple #24
0
        protected override void Initialize()
        {
            game = new GameManager(this);

            game.deactivate();

            game.GameOver += GameOver;

            game.GameOver += EndGame;

            game.Pause += PauseGame;

            Components.Add(game);

            initializeMenus();

            initializeMediaPlayer();

            initializeStorage();

            initializeAudio();

            base.Initialize();
        }
Exemple #25
0
        public PaperDoll()
        {
            // Create target arrays
            paperDollColors  = new Color32[paperDollWidth * paperDollHeight];
            paperDollIndices = new byte[paperDollWidth * paperDollHeight];

            // Setup panels
            Size = new Vector2(paperDollWidth, paperDollHeight);
            characterPanel.Size = new Vector2(paperDollWidth, paperDollHeight);

            // Add panels
            Components.Add(backgroundPanel);
            Components.Add(characterPanel);

            // Set initial display flags
            backgroundPanel.Enabled = showBackgroundLayer;
            characterPanel.Enabled  = showCharacterLayer;

            for (int bpIdx = 0; bpIdx < DaggerfallEntity.NumberBodyParts; bpIdx++)
            {
                armourLabels[bpIdx]      = DaggerfallUI.AddDefaultShadowedTextLabel(armourLabelPos[bpIdx], characterPanel);
                armourLabels[bpIdx].Text = "0";
            }
        }
Exemple #26
0
        // Constructor stufferoo for playerino
        public PlayerObjectOverworld(GameScreen screen) : base(screen)
        {
            // Cool sprite stuff
            sprite       = new Sprite(this);
            sprite.Depth = .1f;
            sprite.AddImage("Sprites/Player/playerBattleScreenStill");
            sprite.SpriteOrigin = new Vector2(24, 24);
            Components.Add(sprite);

            // HitBox COmponent
            hitBox = new HitBox(this);
            hitBox.Colliders.Add(new BoxCollider(new Vector2(14, 13)));
            hitBox.Colliders[0].Offset.X = -7;
            hitBox.Colliders[0].Offset.Y = 11;
            hitBox.Priority = 0;
            hitBox.Solid    = true;
            Components.Add(hitBox);

            // Physics
            physics                = new Physics(this);
            physics.Solid          = true;
            physics.GravityEnabled = false;
            Components.Add(physics);

            // Camera
            screen.CamController.Target         = this;
            screen.CamController.MovementAmount = new Vector2(.2f, .2f);

            // Depth fix
            Components.Add(new OverworldDepthFix(this));

            // Controlls variables
            maxSpeed          = 2;
            accelerationSpeed = .5f;
            slowDownSpeed     = .25f;
        }
Exemple #27
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here


            cam         = new Camera(this, new Vector3(6, 6, 2.8f), Vector3.Zero, 5f);
            LittleHouse = new Solid(this, "LittleHouse");
            littleHouse = Util.GenerateBlockFromFile("LittleHouse");
            Monument    = Util.GenerateBlockFromFile("monu1");

            world = new World();

            world.setBlocksAt(0, 0, 0, Monument);


            world.GenerateModel();
            Components.Add(cam);
            Components.Add(LittleHouse);


            effect = new BasicEffect(graphics.GraphicsDevice);

            base.Initialize();
        }
Exemple #28
0
        protected override void Initialize()
        {
            int w = Graphics.GraphicsDevice.DisplayMode.Width;
            int h = GraphicsDevice.DisplayMode.Height;

            System.Console.WriteLine("blah: " + w + h);

            SetResolution();

            Shaders.LoadContent(GraphicsDevice, Content);
            Fonts.LoadContent(Content);
            Textures.LoadHeightmaps(GraphicsDevice);
            Models.LoadContent(Content);

            world = new World(this);
            ui    = new UserInterface(this);

            Components.Add(ui);
            Components.Add(world);

            ppManager = new PostProcessManager();

            base.Initialize();
        }
Exemple #29
0
        void SetNewRenderType(bool legacy, bool minimal)
        {
            if (MapBordersRenderer == null)
            {
                MapBordersRenderer        = new MapBordersRenderer(); Components.Add(MapBordersRenderer);
                MapBordersRenderer.legacy = legacy;
            }
            else
            {
                MapBordersRenderer.UseLegacyMode(legacy);
            }

            if (EnvRenderer == null)
            {
                EnvRenderer         = new StandardEnvRenderer(); Components.Add(EnvRenderer);
                EnvRenderer.legacy  = legacy;
                EnvRenderer.minimal = minimal;
            }
            else
            {
                EnvRenderer.UseLegacyMode(legacy);
                EnvRenderer.UseMinimalMode(minimal);
            }
        }
Exemple #30
0
        public VVI()
            : base("VVI", new Size(220, 452))
        {
            _vviTape      = new GaugeNeedle("{Helios}/Gauges/F-16/VVI/vvi_tape.xaml", new Point(110, 226), new Size(130, 1960), new Point(65, 980));
            _vviTape.Clip = new RectangleGeometry(new Rect(55d, 86d, 130d, 280d));
            Components.Add(_vviTape);

            _offFlagImage          = new GaugeImage("{Helios}/Gauges/F-16/VVI/vvi_off_flag.xaml", new Rect(55d, 84d, 111d, 282d));
            _offFlagImage.IsHidden = true;
            Components.Add(_offFlagImage);

            Components.Add(new GaugeImage("{Helios}/Gauges/F-16/VVI/vvi_faceplate.xaml", new Rect(0, 0, 220, 452)));

            Components.Add(new GaugeImage("{Helios}/Gauges/F-16/VVI/vvi_bezel.png", new Rect(0, 0, 220, 452)));

            _offFlag          = new HeliosValue(this, new BindingValue(false), "", "off flag", "Indicates whether the off flag is displayed.", "True if displayed.", BindingValueUnits.Boolean);
            _offFlag.Execute += new HeliosActionHandler(OffFlag_Execute);
            Actions.Add(_offFlag);

            _verticalVelocity          = new HeliosValue(this, new BindingValue(0d), "", "vertical velocity", "Current", "", BindingValueUnits.FeetPerMinute);
            _verticalVelocity.Execute += new HeliosActionHandler(VerticalVelocity_Execute);
            Actions.Add(_verticalVelocity);
            Values.Add(_verticalVelocity);
        }