Exemplo n.º 1
0
        private void OnTriggerStay2D(Collider2D other)
        {
            Hotspot otherHotspot = other.GetComponent <Hotspot>();

            if (otherHotspot != null && otherHotspot.PlayerIsWithinBoundary() && IsLayerCorrect(other.gameObject.layer, true))
            {
                if (nearestHotspot == null ||
                    (transform.position - other.transform.position).sqrMagnitude <= (transform.position - nearestHotspot.transform.position).sqrMagnitude)
                {
                    nearestHotspot = otherHotspot;
                }

                foreach (Hotspot hotspot in hotspots)
                {
                    if (hotspot == otherHotspot)
                    {
                        return;
                    }
                }
                hotspots.Add(otherHotspot);
            }
        }
Exemplo n.º 2
0
        protected void OnTriggerStay2D(Collider2D other)
        {
            Hotspot otherHotspot = other.GetComponent <Hotspot>();

            if (otherHotspot != null && otherHotspot.PlayerIsWithinBoundary() && IsLayerCorrect(other.gameObject.layer, true))
            {
                if (nearestHotspot == null ||
                    (transform.position - other.transform.position).sqrMagnitude <= (transform.position - nearestHotspot.transform.position).sqrMagnitude)
                {
                    nearestHotspot = otherHotspot;
                }

                foreach (Hotspot hotspot in hotspots)
                {
                    if (hotspot == otherHotspot)
                    {
                        return;
                    }
                }
                hotspots.Add(otherHotspot);
                hotspots = KickStarter.eventManager.Call_OnModifyHotspotDetectorCollection(this, hotspots);
            }
        }