Ejemplo n.º 1
0
 public override void Update(GameTime gameTime)
 {
     pShip.Update(gameTime);
     //Coordinates5 garbage_coords = theUniverse.UpdateLocation(pShip.myLocation,pShip.myPosition);
     //update other ships
     foreach (Ship currentShip in allShips)
     {
         currentShip.Update(gameTime);
         if (tukHelper.determineDistance(currentShip.myPosition, pShip.myPosition) > 1000f) //should we still draw the ship or is it too far away?
         {
             currentShip.visible = false;
         }
         else //i guess we are close enough so lets set it to true
         {
             currentShip.visible = true;
         }
         // if (!pShip.Equals(currentShip))
         //{
         //    if (pShip.collsionRectangle.Intersects(currentShip.collsionRectangle))
         //        currentShip.shieldsUp = !currentShip.shieldsUp;
         // }
     }
     ;
     if (curScreen.ReleaseMe == true)
     {
         curScreen = helmScreen;
     }
     curScreen.Update(gameTime); //update our current screen
     HandleInput(gameTime);      //calls our global input hook, which passes any unprocessed input to the currentitleScreen
 }
Ejemplo n.º 2
0
        public override void Update(GameTime gameTime)
        {
            pShip.Update(gameTime);

            foreach (Ship currentShip in allShips)
            {
                currentShip.Update(gameTime);
                if (tukHelper.determineDistance(currentShip.myPosition, pShip.myPosition) > 1000f) //should we still draw the ship or is it too far away?
                {
                    currentShip.visible = false;
                }
                else //i guess we are close enough so lets set it to true
                {
                    currentShip.visible = true;
                }
                if (!pShip.Equals(currentShip))
                {
                    currentShip.collisionRectangle.X -= 10;
                    if (currentShip.collisionRectangle.Contains(new Point((int)pShip.beamController.singleFireTarget.X, (int)pShip.beamController.singleFireTarget.Y)))
                    {
                        currentShip.shieldsUp         = !currentShip.shieldsUp;
                        currentShip.shieldPercentage -= 30 * gameTime.ElapsedGameTime.Milliseconds * 0.01f;
                    }
                    //still off.
                    if (RectCollision.Check(currentShip.collisionRectangle, pShip.ROTATION_POINT, currentShip.rotationAngle,
                                            pShip.collisionRectangle, pShip.myPosition, pShip.rotationAngle))
                    {
                        currentShip.shieldsUp = !currentShip.shieldsUp;
                    }
                }
            }

            if (curScreen.ReleaseMe == true)
            {
                curScreen = helmScreen;
            }
            curScreen.Update(gameTime); //update our current screen
            HandleInput(gameTime);      //calls our global input hook, which passes any unprocessed input to the currentitleScreen

            //update network
            NetworkManager.Update(gameTime);
        }