private void onModified() { if (_accessory == null && _railRoad == null && _road == null) { remove(); } // update surrounding voxels if necessary if (_railRoad != null) { _railRoad.invalidateVoxel(); } if (_road != null) { _road.invalidateVoxel(); } // create/remove crossing. bool b = shouldHaveCrossing(); if (b && _accessory == null) { accessory = new RRCrossing(this); return; } if (!b && _accessory is RRCrossing) { accessory = null; return; } }