예제 #1
0
    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();
            }
        }
    }