Update() public method

public Update ( float dt, World world ) : void
dt float
world World
return void
Example #1
0
        public override void Update(GameTime gameTime)
        {
            EvaluateMouseCamControls(gameTime);

            Vector3 upVector     = duneBuggyOne.BuggyObject.Transform.AbsoluteTransform.Translation - earth.Transform.AbsoluteTransform.Translation;
            Vector3 lengthVector = spaceShipOne.ShipObject.Transform.AbsoluteTransform.Translation - earth.Transform.AbsoluteTransform.Translation;;

            if (upVector != Vector3.Zero)
            {
                upVector.Normalize();
            }
            duneBuggyOne.Update(gameTime);

            spaceShipOne.Update(gameTime, (lengthVector.Length() < (earth.radius * 1.05f)));

            duneBuggyCamera.Update(gameTime, earth, PlayerIndex.One);
            spaceShipCamera.Update(gameTime);

            PlanetBuilder.Update();
            earth.Update(gameTime);

            if (input.EvaluateInputBinding("MainMenu"))
            {
                SystemCore.ScreenManager.AddAndSetActive(new MainMenuScreen());
            }



            base.Update(gameTime);
        }
Example #2
0
 void Update()
 {
     for (int f = 0; f < 6; f++)
     {
         StartCoroutine(planet.Update(f));
     }
 }
Example #3
0
 private void Update()
 {
     if (generated == true)
     {
         planet.Update(transform.position, radius, noise, scale, terrainMaterial, waterMaterial);
     }
 }
Example #4
0
 /// <summary>
 /// Mets à jour les éléments de la scène.
 /// </summary>
 public void Update(GameTime time)
 {
     Input.Update();
     FPSCounter.AddFrame((float)time.LastFrameElapsedTime.TotalSeconds);
     DiagnosisWindow.Text = "Perf Diagnostic (" + FPSCounter.GetAverageFps().ToString() + " fps)";
     ThreadPool.Update();
     UpdateMouseCamera(time);
     Planet.Update(time);
 }
Example #5
0
            public void WillUpdatePlanetMana()
            {
                var planet = new Planet {
                    ManaCount = 1, ManaBonus = 1
                };
                var output = planet.Update(new GalaxySettings(), new PlayerBonuses());

                Assert.AreEqual(output.Mana, 1);
            }
Example #6
0
            public void WillUpdatePlanetIron()
            {
                var planet = new Planet {
                    MineCount = 1, IronBonus = 1
                };
                var output = planet.Update(new GalaxySettings(), new PlayerBonuses());

                Assert.AreEqual(output.Iron, 1);
            }
Example #7
0
            public void WillUpdatePlanetEnergy()
            {
                var planet = new Planet {
                    EnergyLabCount = 1, EnergyBonus = 1
                };
                var output = planet.Update(new GalaxySettings(), new PlayerBonuses());

                Assert.AreEqual(output.Energy, 1);
            }
Example #8
0
            public void WillUpdateThePlanetPopulationIfZeroCount()
            {
                var planet = new Planet();

                planet.Update(new GalaxySettings {
                    BasePopulation = 1
                }, new PlayerBonuses());

                Assert.AreEqual(planet.Population, 1);
            }
Example #9
0
            public void WillUpdatePlanetFood()
            {
                var planet = new Planet {
                    FarmCount = 1, FoodBonus = 1
                };
                var output = planet.Update(new GalaxySettings {
                    FoodOutput = 1
                }, new PlayerBonuses());

                Assert.AreEqual(output.Food, 1);
            }
Example #10
0
            public void WillUpdatePlanetResearch()
            {
                var planet = new Planet {
                    ResearchLabCount = 1, ResearchBonus = 1
                };
                var output = planet.Update(
                    new GalaxySettings {
                    ResearchOutput = 1
                }, new PlayerBonuses {
                    ResearchBonus = 1
                });

                Assert.AreEqual(output.Research, 1);
            }
Example #11
0
            public void WillUpdateThePlanetPopulationSizeToPlanetMax()
            {
                var planet = new Planet();

                planet.Update(
                    new GalaxySettings {
                    BasePopulation = 1, PopulationGrowth = 100
                },
                    new PlayerBonuses {
                    WelfareBonus = 1
                });

                Assert.AreEqual(planet.Population, 1);
            }
Example #12
0
            public void WillUpdateThePlanetPopulationSize()
            {
                var planet = new Planet {
                    BuildingCapacity = 10
                };

                planet.Update(
                    new GalaxySettings {
                    BasePopulation = 1, PopulationGrowth = 100, MaxPopulationPerBuildings = 1
                },
                    new PlayerBonuses {
                    WelfareBonus = 1
                });

                Assert.AreEqual(planet.Population, 2);
            }
Example #13
0
        public void PlanetUpdateTest()
        {
            var v = new Vector2D();
            var p = new Planet(v, 15, Color.Black);

            //an acceleration vector
            var acc = new Vector2D();

            acc.x  += 10; //x direction = 10
            p.Accel = acc;

            p.Update(10); //dt = 10
            var actual   = p.pos;
            var expected = acc * 10 * 10;

            Assert.AreEqual(actual.x, expected.x, "Shuld both be 1000"); //compare the x values
            //this confirms that btoh velocity and position is calculated accurately
        }
Example #14
0
            public void WillUpdateThePlanetCashFactoryCash()
            {
                var planet = new Planet {
                    CashBonus = 1, CashFactoryCount = 1
                };

                var galaxySettings = new GalaxySettings {
                    CashOutput = 2
                };

                var playerBonuses = new PlayerBonuses {
                    EconomyBonus = 1
                };

                var output = planet.Update(galaxySettings, playerBonuses);

                Assert.AreEqual(output.CashFactoryCash, 2);
            }
Example #15
0
            public void WillUpdateThePlanetTaxOfficeCash()
            {
                var planet = new Planet {
                    CashBonus = 1, TaxOfficeCount = 1
                };

                var galaxySettings = new GalaxySettings {
                    PopulationCashDivider = 1, PositiveIncomeCash = 1
                };

                var playerBonuses = new PlayerBonuses {
                    EconomyBonus = 1
                };

                var output = planet.Update(galaxySettings, playerBonuses);

                Assert.AreEqual(output.TaxOfficeCash, 1);
            }
Example #16
0
            public void WillUpdateThePlanetPopulationCash()
            {
                var planet = new Planet {
                    CashBonus = 1, Population = 1
                };

                var galaxySettings = new GalaxySettings {
                    PopulationCashDivider = 1, BasePopulation = 1
                };

                var playerBonuses = new PlayerBonuses {
                    EconomyBonus = 1
                };

                var output = planet.Update(galaxySettings, playerBonuses);

                Assert.AreEqual(output.PopulationCash, 1);
            }
Example #17
0
        public void Update()
        {
            foreach (Background_effects star in StarList)
            {
                star.Update(0.05f);
                if (star.Position.Y >= 800)
                {
                    star.isAlive = false;
                }
            }
            foreach (Background_effects Nebula in NebulaList)
            {
                Nebula.Update();
            }
            foreach (Background_effects Planet in PlanetList)
            {
                Planet.Update();
                if (Planet.Position.Y >= ScreenSize.Y * 2)
                {
                    Planet.isAlive = false;
                }
            }

            if (StarList.Count >= 200)
            {
                StarList.RemoveAt(0);
            }

            Timer[1]++;
            if (Timer[1] >= 2000)
            {
                //AddNebula();
                AddPlanet();
                Timer[1] = 0;
            }

            Timer[0]++;
            if (Timer[0] >= 1.5f)
            {
                RandStarPosNum = RandStarPos.Next(701);
                AddStar(RandStarPosNum, RandStarPosNum);
                Timer[0] = 0;
            }
        }
Example #18
0
            public void WillUpdateThePlanetBuildingCount()
            {
                var planet = new Planet
                {
                    CashFactoryCount    = 1,
                    EnergyLabCount      = 1,
                    FarmCount           = 1,
                    LaserCount          = 1,
                    LivingQuartersCount = 1,
                    ManaCount           = 1,
                    MineCount           = 1,
                    ResearchLabCount    = 1,
                    TaxOfficeCount      = 1,
                    HasPortal           = true
                };

                planet.Update(new GalaxySettings(), new PlayerBonuses());

                Assert.AreEqual(planet.TotalBuildings, 10);
            }
Example #19
0
 private static void Engine_OnUpdate(double time_ms, double delta_ms)
 {
     planetBuffers.Update();
     planet.Update();
 }
Example #20
0
        //#################################
        // Update
        //#################################
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                    bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, false);
            _soundEngine.Update();

            SoundDJ();
            PlayVoice();
            // Gradually fade in or out depending on whether we are covered by the pause screen.
            if (coveredByOtherScreen)
            {
                _pauseAlpha = Math.Min(_pauseAlpha + 1f / 32, 1);
            }
            else
            {
                _pauseAlpha = Math.Max(_pauseAlpha - 1f / 32, 0);
            }

            DebugFunctions();
            _input.Update();

            if (!coveredByOtherScreen)
            {
                if (_sphereAlpha > 0.1f)
                {
                    _sphereAlpha -= 0.001f;
                }

                //boids
                _waveBuilder.Update(gameTime, ref _asteroidField, ref _droneFleet);

                // calling update of objects where necessary
                _station.Update(gameTime);
                _planet.Update(gameTime);
                _droneFleet.Update(gameTime, !_station.IsDead);
                _asteroidField.Update(gameTime, _droneFleet.GetActiveDrone().Position);
                Global.Camera.updateCameraPositionTarget(_droneFleet.GetActiveDrone().Position + Global.CameraPosition, _droneFleet.GetActiveDrone().Position);


                // Particles
                dustParticles.Update(gameTime);
                UpdateBorder(gameTime);
                hitmarkerParticles.Update(gameTime);

                foreach (ExplosionSystem explosion in explosionList)
                {
                    explosion.Update(gameTime);
                    if (explosion._state == 2)
                    {
                        explosionRemoveList.Add(explosion);
                    }
                }

                foreach (var explosion in explosionRemoveList)
                {
                    explosionList.Remove(explosion);
                }
                explosionRemoveList.Clear();


                if (_waveBuilder.HasEnded && deadTime <= 0 && _station._health > 0)
                {
                    Global.HighScorePoints += Global.Money;
                    LoadingScreen.Load(ScreenManager, true, new BackgroundScreen(), new MainMenuScreen(), new HighscoreMenuScreenOnline(true));
                }
                // if station dies go back to MainMenu
                // TODO: change to EndScreen and HighScore list)
                if (_station._health <= 0 && deadTime <= 0)
                {
                    LoadingScreen.Load(ScreenManager, true, new BackgroundScreen(), new MainMenuScreen(), new HighscoreMenuScreenOnline(true));
                }

                CollisionHandling(gameTime);


                // fading out/in when drone is dead & alive again
                if (!_droneFleet.GetActiveDrone().IsNotDead)
                {
                    _deadDroneAlpha = Math.Min(_deadDroneAlpha + 1f / 32, 1);
                }
                else
                {
                    _deadDroneAlpha = Math.Max(_deadDroneAlpha - 1f / 32, 0);
                }

                // if fading out is max, respawn
                if (_actualDeadDroneAlpha >= 1f)
                {
                    _droneFleet.replaceOldDrone();
                    Global.HighScorePoints -= 200;
                    _deathCounter++;
                }
            }
        }
        //#################################
        // Update
        //#################################
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                    bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, false);

            if (once)
            {
                if (!voice)
                {
                    Global.Music.Stop();
                    voice = true;
                    Global.SpeakerVolume = 0;
                }
                if (Global.Music.Finished)
                {
                    once         = false;
                    Global.Music = Global.MusicEngine.Play2D("voice_intro", (Global.MusicVolume * 4 / 10), false);
                }
            }
            SoundDJ();
            if (_sphereAlpha > 0.1f)
            {
                _sphereAlpha -= 0.001f;
            }

            dustParticles.Update(gameTime);
            // Gradually fade in or out depending on whether we are covered by the pause screen.
            if (coveredByOtherScreen)
            {
                _pauseAlpha = Math.Min(_pauseAlpha + 1f / 32, 1);
            }
            else
            {
                _pauseAlpha = Math.Max(_pauseAlpha - 1f / 32, 0);
            }

            foreach (ExplosionSystem explosion in explosionList)
            {
                explosion.Update(gameTime);
            }

            // calling update of objects where necessary
            _station.Update(gameTime);
            _planet.Update(gameTime);
            if (movementAllowed)
            {
                _droneFleet.Update(gameTime, movementAllowed);
                _asteroidField.Update(gameTime, _station.Position);
            }

            Global.Camera.updateCameraPositionTarget(_droneFleet.GetActiveDrone().Position + Global.CameraPosition, _droneFleet.GetActiveDrone().Position);

            // if station dies go back to MainMenu
            // TODO: change to EndScreen and HighScore list)
            if (_station._health <= 0)
            {
                LoadingScreen.Load(ScreenManager, true, new BackgroundScreen(), new MainMenuScreen());
            }
            explosionParticles.Update(gameTime);
            CollisionHandling(gameTime);
            UpdateBorder(gameTime);

            // drone is dead
            if (!_droneFleet.GetActiveDrone().IsNotDead)
            {
                LoadingScreen.Load(ScreenManager, true, new BackgroundScreen(), new MainMenuScreen());
            }
        }