예제 #1
0
 public void SetHoverBehaviourChangeColor(Color colorOver, Color colorOut)
 {
     hoverBehaviourType         = HoverBehaviour.Change_Color;
     hoverBehaviour_Color_Enter = colorOver;
     hoverBehaviour_Color_Exit  = colorOut;
     if (hoverBehaviour_Image == null)
     {
         hoverBehaviour_Image = transform.GetComponent <SpriteRenderer>();
     }
     hoverBehaviour_Image.color = hoverBehaviour_Color_Exit;
     SetupHoverBehaviour();
 }
예제 #2
0
        public void SetHoverBehaviourType(HoverBehaviour hoverBehaviourType)
        {
            this.hoverBehaviourType = hoverBehaviourType;
            switch (hoverBehaviourType)
            {
            case HoverBehaviour.Change_Color:
                hoverBehaviourFunc_Enter = delegate() { hoverBehaviour_Image.color = hoverBehaviour_Color_Enter; };
                hoverBehaviourFunc_Exit  = delegate() { hoverBehaviour_Image.color = hoverBehaviour_Color_Exit; };
                break;

            case HoverBehaviour.Change_Image:
                hoverBehaviourFunc_Enter = delegate() { hoverBehaviour_Image.sprite = hoverBehaviour_Sprite_Enter; };
                hoverBehaviourFunc_Exit  = delegate() { hoverBehaviour_Image.sprite = hoverBehaviour_Sprite_Exit; };
                break;

            case HoverBehaviour.Change_SetActive:
                hoverBehaviourFunc_Enter = delegate() { hoverBehaviour_Image.gameObject.SetActive(true); };
                hoverBehaviourFunc_Exit  = delegate() { hoverBehaviour_Image.gameObject.SetActive(false); };
                break;
            }
        }
예제 #3
0
        public void SetHoverBehaviourType(HoverBehaviour hoverBehaviourType)
        {
            this.hoverBehaviourType = hoverBehaviourType;
            switch (hoverBehaviourType)
            {
            case HoverBehaviour.Change_Color:
                hoverBehaviourFunc_Enter = delegate() { hoverBehaviour_Image.color = hoverBehaviour_Color_Enter; };
                hoverBehaviourFunc_Exit  = delegate() { hoverBehaviour_Image.color = hoverBehaviour_Color_Exit; };
                break;

            case HoverBehaviour.Change_Image:
                hoverBehaviourFunc_Enter = delegate() { hoverBehaviour_Image.sprite = hoverBehaviour_Sprite_Enter; };
                hoverBehaviourFunc_Exit  = delegate() { hoverBehaviour_Image.sprite = hoverBehaviour_Sprite_Exit; };
                break;

            case HoverBehaviour.Change_SetActive:
                hoverBehaviourFunc_Enter = delegate() { hoverBehaviour_Image.gameObject.SetActive(true); };
                hoverBehaviourFunc_Exit  = delegate() { hoverBehaviour_Image.gameObject.SetActive(false); };
                break;

            case HoverBehaviour.Change_Color_Auto:
                Color color = hoverBehaviour_Image.color;
                if (color.r >= 1f)
                {
                    color.r = .9f;
                }
                if (color.g >= 1f)
                {
                    color.g = .9f;
                }
                if (color.b >= 1f)
                {
                    color.b = .9f;
                }
                Color colorOver = color * 1.3f; // Over color lighter
                hoverBehaviourFunc_Enter = delegate() { hoverBehaviour_Image.color = colorOver; };
                hoverBehaviourFunc_Exit  = delegate() { hoverBehaviour_Image.color = color; };
                break;
            }
        }