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"; }
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(); }
public ExplosionParticle(Vector2 position, Vector2 speed, int life, GameObjectsManager manager) : base(manager) { Position = position; this.speed = speed; Life = life; Width = 80; Height = 80; }
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; }
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(); }
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--; } }
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); }
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); }
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"; }
public LiftObjectTestClass(Vector2 position, float resistance, GameObjectsManager manager) : base(position, resistance, manager, 0, 0) { }
public Projectile(Vector2 position, int healthModifier, GameObjectsManager manager) : base(manager) { Position = position; HealthModifier = healthModifier; }
// 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; }
public GameObject(GameObjectsManager manager) { this.manager = manager; }