/// <summary> /// Clean up remaining resources, right before the game closes. /// </summary> protected override void OnPreDestroy() { TotalTurns = 0; Trail.Destroy(); EventDirector.Destroy(); Vehicle = new Vehicle(); Vehicle = null; Trail = null; EventDirector = null; Instance = null; }
/// <summary> /// Called when simulation is about to destroy itself, but right before it actually does it. /// </summary> protected override void OnPreDestroy() { // Notify modules of impending doom allowing them to save data. Scoring.Destroy(); Tombstone.Destroy(); Time.Destroy(); EventDirector.Destroy(); Trail.Destroy(); // Null the destroyed instances. Scoring = null; Tombstone = null; Time = null; EventDirector = null; Trail = null; TotalTurns = 0; Vehicle = null; // Destroys game simulation instance. Instance = null; }