コード例 #1
0
        private List <ObjectProximityInfo> FetchObjects(IProximityEffectObjectProvider provider)
        {
            var registeredObjects = new List <ObjectProximityInfo>();

            provider.ForEachProximityObject(proximityObject =>
            {
                registeredObjects.Add(new ObjectProximityInfo()
                {
                    ScaledObject         = proximityObject,
                    ObjectVisualRenderer = proximityObject.gameObject.GetComponentInChildren <Renderer>()
                });
            });

            return(registeredObjects);
        }
コード例 #2
0
        /// <summary>
        /// register objects for proximity effect via a <see cref="IProximityEffectObjectProvider"/>
        /// </summary>
        public void AddObjects(IProximityEffectObjectProvider provider)
        {
            RegisteredObjects registeredObject = new RegisteredObjects()
            {
                objectProvider = provider, proximityInfos = new List <ObjectProximityInfo>()
            };

            provider.ForEachProximityObject(proximityObject =>
            {
                registeredObject.proximityInfos.Add(new ObjectProximityInfo()
                {
                    ScaledObject         = proximityObject,
                    ObjectVisualRenderer = proximityObject.gameObject.GetComponentInChildren <Renderer>()
                });
            });
            registeredObjects.Add(registeredObject);
        }