private void OnTriggerEnter(Collider other) { // If the collider is a player, cause the player to fail Racecar player = other.GetComponentInParent <Racecar>(); if (player != null) { if (this.isTimePenalty) { VariableManager.AddPenalty(SlalomCone.timePenalty); Destroy(this.gameObject); } else { player.Hud.ShowFailureMessage(isRed ? SlalomCone.redMessage : SlalomCone.blueMessage); } } }