private void fillMatrix() { for (int i = 0; i < k_Rows; i++) { setEnemySpaceShipProperties(i); for (int j = 0; j < k_Cols + m_AdditionalColsPerLevel; j++) { m_Matrix[i, j] = new EnemySpaceShip(Game, m_EnemySpaceShipColor, m_EnemyType, new Point(i, j)); m_Matrix[i, j].EnemyDied += enemySpaceShip_EnemyDied; this.Add(m_Matrix[i, j]); } } }
protected override void Dispose(bool i_Disposing) { PlayerSpaceShip playerSpaceShip = m_BulletOwner as PlayerSpaceShip; EnemySpaceShip enemySpaceShip = m_BulletOwner as EnemySpaceShip; base.Dispose(i_Disposing); this.Visible = false; if (playerSpaceShip != null) { playerSpaceShip.RemoveBulletFromCollection(this); } else if (enemySpaceShip != null) { enemySpaceShip.RemoveBulletFromCollection(this); } }
private bool didReachLeftBoundry(EnemySpaceShip i_Enemy) { return(i_Enemy.Position.X <= Game.GraphicsDevice.Viewport.Bounds.Left); }
private bool didReachRightBoundry(EnemySpaceShip i_Enemy) { return(i_Enemy.Position.X + i_Enemy.Width >= Game.GraphicsDevice.Viewport.Bounds.Right); }