protected void NotifyDetectorVolumeOfChanges() { //Don't notify the detector volume if we have a parent. The parent will analyze our state. if (Parent == null) { //Beware the order! //Starts touching -> starts containing if (!WasTouching && Touching) { DetectorVolume.BeganTouching(this); } if (!WasContaining && Containing) { DetectorVolume.BeganContaining(this); } //Stops containing -> stops touching if (WasContaining && !Containing) { DetectorVolume.StoppedContaining(this); } if (WasTouching && !Touching) { DetectorVolume.StoppedTouching(this); } } }