// Start is called before the first frame update
        void Start()
        {
            //Add box collider so touches are caught.
            if (GetComponent <BoxCollider>() == null)
            {
                BoxCollider collider = gameObject.AddComponent <BoxCollider>();
                collider.size = new Vector3(collider.size.x, collider.size.y, 0.01f);
            }


            //Get Sprite Info
            spriteRend   = GetComponent <SpriteRenderer>();
            initialColor = spriteRend.color;

            //Get Hotspot Script
            hotspot = GetComponent <IHotspot>();

            //Create hotspot glow if it's enabled from HotspotController.
            HotspotController hotspotController = this.gameObject.GetComponentInParent <HotspotController>();

            if (hotspotController != null && hotspotController.hotspotEffects == HotspotController.HotspotEffects.Glow)
            {
                this.gameObject.AddComponent <CreateHotspotGlow>().SetValue(hotspotController.hotspotGlowSettings);
            }
        }
Beispiel #2
0
        private void FindPresentingHotspotController()
        {
            var controllerTransform = transform.parent;

            if (controllerTransform.GetComponent <HotspotBatch>())
            {
                controllerTransform = controllerTransform.parent;
            }
            controller = controllerTransform.GetComponent <HotspotController>();
        }
        private void FindPresentingHotspotControllerOrMultiHotspot()
        {
            var controllerTransform = transform.parent;

            if (controllerTransform.GetComponent <HotspotBatch>())
            {
                controllerTransform = controllerTransform.parent;
            }
            else if (controllerTransform.GetComponent <MultiHotspot>())
            {
                presentingMultiHotspot = controllerTransform.GetComponent <MultiHotspot>();
            }
            controller = controllerTransform.GetComponent <HotspotController>();
        }
        /// <summary>
        /// Create Glow effect for Text and Background image
        /// </summary>
        public void SetGlow()
        {
            HotspotController hotspotController = this.gameObject.GetComponentInParent <HotspotController>();

            if (hotspotController != null && hotspotController.hotspotEffects == HotspotController.HotspotEffects.Glow)
            {
                textGlow.gameObject.AddComponent <PulseAnimation>().InitSettings(hotspotController.hotspotGlowSettings);
                textGlow.gameObject.AddComponent <DisableGlowWhenHotspotDisabled>().Init(this.GetComponentInParent <IHotspot>());

                if (spriteRendererBackground.sprite != null && isBackground && imageProperty.color.a >= 1.0)
                {
                    spriteRendererBackground.gameObject.AddComponent <CreateHotspotGlow>().SetValue(hotspotController.hotspotGlowSettings);
                }
            }
        }