Example #1
0
        private void OnTrackedInteractiveObjectDestroyed(CoreInteractiveObject trackedInteractiveObject)
        {
            List <RangeIntersectionCalculator> RangeIntersectionCalculatorsToDestroy = null;

            for (var i = 0; i < this.AllRangeIntersectionCalculatorV2.Count; i++)
            {
                var currentIntersectionCalculator = this.AllRangeIntersectionCalculatorV2[i];
                if (currentIntersectionCalculator.TrackedInteractiveObject == trackedInteractiveObject)
                {
                    if (RangeIntersectionCalculatorsToDestroy == null)
                    {
                        RangeIntersectionCalculatorsToDestroy = new List <RangeIntersectionCalculator>();
                    }

                    RangeIntersectionCalculatorsToDestroy.Add(currentIntersectionCalculator);
                }
            }

            if (RangeIntersectionCalculatorsToDestroy != null)
            {
                foreach (var rangeIntersectionCalculatorToDestroy in RangeIntersectionCalculatorsToDestroy)
                {
                    rangeIntersectionCalculatorToDestroy.OnDestroy();
                    this.AllRangeIntersectionCalculatorV2.Remove(rangeIntersectionCalculatorToDestroy);
                }
            }
        }
Example #2
0
        /// <summary>
        /// On RangeObject destroyed, every <see cref="RangeIntersectionCalculator"/> in <see cref="AllRangeIntersectionCalculatorV2"/> that references the
        /// <paramref name="RangeObjectV2"/> must be destroyed.
        /// </summary>
        private void OnRangeObjectDestroyed(RangeObjectV2 RangeObjectV2)
        {
            List <RangeIntersectionCalculator> RangeIntersectionCalculatorsToDestroy = null;

            for (var i = 0; i < this.AllRangeIntersectionCalculatorV2.Count; i++)
            {
                var currentIntersectionCalculator = this.AllRangeIntersectionCalculatorV2[i];
                if (currentIntersectionCalculator.GetAssociatedRangeObject() == RangeObjectV2)
                {
                    if (RangeIntersectionCalculatorsToDestroy == null)
                    {
                        RangeIntersectionCalculatorsToDestroy = new List <RangeIntersectionCalculator>();
                    }

                    RangeIntersectionCalculatorsToDestroy.Add(currentIntersectionCalculator);
                }
            }

            if (RangeIntersectionCalculatorsToDestroy != null)
            {
                foreach (var rangeIntersectionCalculatorToDestroy in RangeIntersectionCalculatorsToDestroy)
                {
                    rangeIntersectionCalculatorToDestroy.OnDestroy();
                    this.AllRangeIntersectionCalculatorV2.Remove(rangeIntersectionCalculatorToDestroy);
                }
            }
        }