void OnHitboxCollision(Collider other) { TrainBox otherBox = other.GetComponent <TrainBox>(); if (otherBox != null) { TrainController otherTrain = otherBox.parentTrain; bool killOtherTrain = otherBox.type == TrainBox.Type.hurt; if (killOtherTrain) { otherTrain.Die(); } } }