Exemple #1
0
        /// <summary>
        /// Launched when a ray stops hitting the object.
        /// </summary>
        /// <param name="ray"></param>
        public virtual void HitExit(Ray ray)
        {
            foreach (var emittedRay in EmittedRays)
            {
                if (emittedRay.Parent != null && emittedRay.Parent.Id == ray.Id)
                {
                    Ray.Delete(emittedRay);
                }
            }

            EmittedRays.RemoveAll(r => r.Parent != null && r.Parent.Id == ray.Id);

            for (int i = 0; i < ReceveidRays.Count; i++)
            {
                if (ReceveidRays[i].Id == ray.Id)
                {
                    ReceveidRays.RemoveAt(i);

                    Debug.LogWarning(string.Format("{0} {1} stopped hitting {2} {3} with color {4} and direction {5}",
                                                   ray.RayEmitter.transform.gameObject,
                                                   ray.RayEmitter.transform.gameObject.GetInstanceID(),
                                                   transform.gameObject,
                                                   transform.gameObject.GetInstanceID(),
                                                   ray.Color,
                                                   ray.Direction
                                                   ));
                    break;
                }
            }

            if (EmittedRays.Count == 0)
            {
                StopReboundFeedback();
            }
        }
Exemple #2
0
        public void DestroyEmittedRays()
        {
            foreach (var emittedRay in EmittedRays)
            {
                Ray.Delete(emittedRay);
            }

            EmittedRays.Clear();
        }