Exemple #1
0
        public void Update(GameTime gt, KeyboardState kb, KeyboardState kbOld, int gs, Camera2D camera)
        {
            Player1.Update(gt, kb, kbOld, camera);
            Ship.Update(gt, kb, kbOld, camera);

            /*if (Math.Abs(Player1.MovementSpeed.X) + Math.Abs(Player1.MovementSpeed.Y) > 2) {
             *  if ((int)gt.TotalGameTime.TotalSeconds % 5 == 0) {
             *      Meteorite meteorite = new Meteorite(Resources.Meteor, Resources.MeteorMask,
             *          Player1.Position, Player1.MovementSpeed);
             *      meteoriteList.Add(meteorite);
             *  }
             * }*/

            //Check through game states for collision logic
            if (ObjectiveStatus == 1 || ObjectiveStatus == 3 || ObjectiveStatus == 5)
            {
                if (Player1.BoundingBox.Intersects(Ship.BoundingBox))
                {
                    ObjectiveStatus++;
                    Ship.ShipStatus++;
                    Player1.Inventory.RemoveAt(Player1.Inventory.Count - 1);
                    Resources.Repair.Play();
                    Hud.AddMessage(ObjectiveStatus);
                }
            }
            else if (ObjectiveStatus == 0 || ObjectiveStatus == 2 || ObjectiveStatus == 4)
            {
                Collectible col = Objectives.Peek();
                if (Player1.BoundingBox.Intersects(col.BoundingBox))
                {
                    Player1.Inventory.Add(Objectives.Pop());
                    ObjectiveStatus++;
                    Resources.Pickup.Play();
                    Hud.AddMessage(ObjectiveStatus);
                }
            }

            /*foreach (Meteorite meteorite in meteoriteList) {
             *  meteorite.Update(gt);
             * }*/

            base.Update(gt);
        }