Update() 공개 메소드

public Update ( GameTime gameTime ) : void
gameTime Microsoft.Xna.Framework.GameTime
리턴 void
예제 #1
0
        public void CheckCollisionTest()
        {
            GameObjectsManager gameObjectsManager = new GameObjectsManager(new Spaceship(), new Random());
            SmallRocket rocket = new SmallRocket(new Vector2(5, 400), gameObjectsManager);
            gameObjectsManager.AddObject(rocket);
            gameObjectsManager.Update(new GameTime());
            int hp = gameObjectsManager.CheckCollisions();

            Assert.IsFalse(hp < 0);

            SmallRocket rocket2 = new SmallRocket(new Vector2(5, 50), gameObjectsManager);
            gameObjectsManager.AddObject(rocket2);
            gameObjectsManager.Update(new GameTime());
            hp = gameObjectsManager.CheckCollisions();

            Assert.IsTrue(hp < 0);
        }
예제 #2
0
        public void LiftObjectsTest()
        {
            Spaceship spaceship = new Spaceship();
            spaceship.X = 49;
            spaceship.Width = 200;
            GameObjectsManager manager = new GameObjectsManager(new Spaceship(), new Random());
            manager.AddRandomObject();
            manager.LiftObjects(spaceship);
            manager.Update(new GameTime());

            PrivateObject privateManager = new PrivateObject(manager);
            List<LiftObject> liftObjects = (List<LiftObject>)privateManager.GetField("liftObjects");

            Assert.IsTrue(liftObjects[0].Position.Y < 500);
        }