private void OnTriggerEnter(Collider collider)
        {
            FriendZoneListener friendZoneListener = collider.GetComponent <FriendZoneListener>();

            if (friendZoneListener)
            {
                friendZoneListener.NotifyMeInZone();
            }
        }
Example #2
0
        private bool isBlinking; // If true, the FriendZone is currently blinking. (effect used in the tutorial)

        public FriendZone(FriendZonesEnum friendZoneEnum, IFriendZoneShape friendZoneShape,
                          FriendZoneCollector friendZoneCollector)
        {
            // Initialize attributes
            FriendZoneEnum            = friendZoneEnum;
            FriendZoneShapeController = new FriendZoneShapeController(friendZoneShape);
            LineRenderer = friendZoneCollector.lineRenderer;
            MeshCollider = friendZoneCollector.meshCollider;
            MeshFilter   = friendZoneCollector.meshFilter;

            Gauge        = new Gauge();
            meshRenderer = friendZoneCollector.meshRenderer;

            // Initialize colors
            switch (friendZoneEnum)
            {
            case FriendZonesEnum.NoGo:
                outColor = FriendZonesConstants.NoGoZoneOutColor;
                inColor  = FriendZonesConstants.NoGoZoneInColor;
                break;

            case FriendZonesEnum.Discomfort:
                outColor = FriendZonesConstants.DiscomfortZoneOutColor;
                inColor  = FriendZonesConstants.DiscomfortZoneInColor;
                break;

            case FriendZonesEnum.Comfort:
                outColor = FriendZonesConstants.ComfortZoneOutColor;
                inColor  = FriendZonesConstants.ComfortZoneInColor;
                break;

            case FriendZonesEnum.Distant:
                outColor = FriendZonesConstants.DistantZoneOutColor;
                inColor  = FriendZonesConstants.DistantZoneInColor;
                break;
            }

            UpdateColor(outColor);

            // Setup FriendZone listener's reference to this class
            FriendZoneListener friendZoneListener = friendZoneCollector.friendZoneListener;

            friendZoneListener.SetCorrespondingFriendZone(this);
        }