예제 #1
0
파일: Cow.cs 프로젝트: csce3513/Team12
        public Cow(Vector2 position, float resistance, GameObjectsManager manager, Random random)
            : base(position, resistance, manager, 1, 1)
        {
            this.random = random;
            actionDuration = new TimeSpan();
            spriteEffect = SpriteEffects.None;
            currentMoveSpeed = MOVE_SPEED;
            Width = 80;
            Height = 60;

            moveLeft = false;
            moveRight = false;
            frightened = false;

            int temp = random.Next(5);
            if (temp == 0)
                cowsound = "cow-moo1";
            else if (temp == 1)
                cowsound = "cow-moo2";
            else if (temp == 2)
                cowsound = "cow-moo3";
            else if (temp == 3)
                cowsound = "cow-moo4";
            else if (temp == 4)
                cowsound = "cow-moo5";
        }
예제 #2
0
 public SmallRocket(Vector2 position, GameObjectsManager manager)
     : base(position, -5, manager)
 {
     Width = 30;
     Height = 10;
     SetVelocity(manager.Spaceship.Position, manager.Spaceship.Width, manager.Spaceship.Height);
     SetRotation();
 }
예제 #3
0
 public ExplosionParticle(Vector2 position, Vector2 speed, int life, GameObjectsManager manager)
     : base(manager)
 {
     Position = position;
     this.speed = speed;
     Life = life;
     Width = 80;
     Height = 80;
 }
예제 #4
0
 public LiftObject(Vector2 position, float resistance, GameObjectsManager manager, int points, int healthModifier)
     : base(manager)
 {
     OriginalY = position.Y;
     Position = position;
     this.resistance = resistance;
     Captured = false;
     Points = points;
     HealthModifier = healthModifier;
 }
예제 #5
0
 public GameScreen()
 {
     background = new Background();
     Spaceship spaceship = new Spaceship();
     input = new InputManager();
     controller = new SpaceshipController(spaceship, input);
     random = new Random();
     gameObjectsManager = new GameObjectsManager(spaceship, random);
     hud = new GameInfo();
     gameObjectsManager.AddStartingCows();
 }
예제 #6
0
 public Explosion(Vector2 position, GameObjectsManager manager, Random random)
     : base(manager)
 {
     Position = position;
     particles = new List<ExplosionParticle>();
     int amount = random.Next(50, 100);
     Amount = amount;
     while (amount > 0)
     {
         particles.Add(new ExplosionParticle(position, new Vector2(random.Next(-2, 3), random.Next(-2, 3)), random.Next(200, 300), manager));
         amount--;
     }
 }
예제 #7
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);
        }
예제 #8
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);
        }
예제 #9
0
파일: Tank.cs 프로젝트: csce3513/Team12
        public Tank(Vector2 position, GameObjectsManager manager, Random random)
            : base(position, 0.98f, manager, 25, -10)
        {
            Position = position;
            Width = 100;
            Height = 80;
            gunWidth = 60;
            gunHeight = 10;
            gunRotation = 0;
            shootTimer = new TimeSpan();
            this.random = random;

            int temp = random.Next(2);
            if (temp == 0)
                rocket_string = "bomb-02";
            else if (temp == 1)
                rocket_string = "bomb-03";
        }
예제 #10
0
 public LiftObjectTestClass(Vector2 position, float resistance, GameObjectsManager manager)
     : base(position, resistance, manager, 0, 0)
 {
 }
예제 #11
0
 public Projectile(Vector2 position, int healthModifier, GameObjectsManager manager)
     : base(manager)
 {
     Position = position;
     HealthModifier = healthModifier;
 }
예제 #12
0
파일: CowBomb.cs 프로젝트: csce3513/Team12
 // Last two digits are score and health modifiers
 public CowBomb(Vector2 position, float resistance, GameObjectsManager manager)
     : base(position, resistance, manager, 0, -10)
 {
     Width = 80;
     Height = 60;
 }
예제 #13
0
 public GameObject(GameObjectsManager manager)
 {
     this.manager = manager;
 }