/// <summary> /// Dispose all the snake components /// </summary> /// <param name="e">event arg passed to us by opentk</param> protected override void OnUnload(EventArgs e) { //Dispose the fruit _fruitTexture.Dispose(); _fruit.Dispose(); _fruitShader.Dispose(); //Dispose the head of the snake _snakeHeadShader.Dispose(); _snakeHeadTexture.Dispose(); _snakeHead.Dispose(); //Dispose the body of the snake _snakeShader.Dispose(); for (int i = 0; i < _snake.Count; i++) { _snake[i].Dispose(); } base.OnUnload(e); }