private void InitializeCollidableObjects() { collisionManager.AddCollidable(ship); foreach (var item in enemies) { collisionManager.AddCollidable(item); } }
private void InitializeCollidableObjects() { collisionManager.AddCollidable(world.Player); foreach (EnemyShip enemy in world.Enemies) { collisionManager.AddCollidable(enemy); } }
//Add enemy to the list, //Add collision to the enemy //Register events public void AddEnemy(Enemy e) { enemies.Add(e); collisionManager.AddCollidable(e); e.FinishEvent += OnEnemyFinish; e.DestroyEvent += OnEnemyDestroy; e.EnemyAttackEvent += projectileManager.OnEnemyAttack; }
//add power up to the list //regisiter event public void AddPowerUp(PowerUp pu) { powerUps.Add(pu); collisionManager.AddCollidable(pu); pu.DestroyEvent += OnCollected; pu.FinishEvent += OnFinished; pu.PowerUpEvent += world.Player.OnPowerUp; }
public void InitialiseLevel() { foreach (IManager manager in managers) { manager.Initialise(); } player.Initialise(); collisionManager.AddCollidable(player); camera.Initialise(); }
private void AddEnemyProjectile(Enemy owner) { //Console.Write(owner + "\n"); EnemyProjectile projectile = new EnemyProjectile(owner); projectile.Initialise(); enemyProjectiles.Add(projectile); collisionManager.AddCollidable(projectile); projectile.FinishEvent += OnFinish; projectile.DestroyEvent += OnDestroy; }
//Setup a projectil //add to the list //register event private void AddPlayerProjectile(int j) { int yOffset = 500; Projectile projectile = new Projectile(player); projectile.Initialise(); Vector3 p = projectile.Position; p.Y += yOffset * j; projectile.Position = new Vector3(p.X, p.Y, p.Z); playerProjectiles.Add(projectile); collisionManager.AddCollidable(projectile); projectile.FinishEvent += OnFinish; projectile.DestroyEvent += OnDestroy; }