private void OnDestroy() { if (current == this) { current = null; } level_builder.game_over(game_over_reason); }
void Start() { movable = GetComponentInParent <Movable>(); level_builder = GameObject.Find("GameSystem").GetComponent <ProceduralLevelBuilder>(); guns = GetComponentsInChildren <Gun>(true); shields = GetComponentsInChildren <Shield>(true); trails = GetComponent <TrailRenderer>(); if (level_builder == null) { Debug.LogError("No level builder found"); } current = this; }