devNotes 10-9-16 Velocity Lerp Threshold and Banding

 

using UnityEngine;
using UnityEngine.EventSystems;
using System.Collections;
 
namespace Sharkbomb.View {
    public class TooltipTrigger : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, ISelectHandler, IDeselectHandler {
 
        public string text;
 
        public void OnPointerEnter(PointerEventData eventData)
        {
            StartHover(new Vector3(eventData.position.x, eventData.position.y - 18f, 0f));
        }   
        public void OnSelect(BaseEventData eventData)
        {
            StartHover(transform.position);
        }
        public void OnPointerExit(PointerEventData eventData)
        {
            StopHover();
        }
        public void OnDeselect(BaseEventData eventData)
        {
            StopHover();
        }
 
        void StartHover(Vector3 position) {
            TooltipView.Instance.ShowTooltip(text, position);
        }
        void StopHover() {
            TooltipView.Instance.HideTooltip();
        }
 
    }
}
using UnityEngine;
using System.Collections;
 
namespace Sharkbomb.View {
    public class TooltipView : MonoBehaviour {
         
        public bool IsActive {
            get {
                return gameObject.activeSelf;
            }
        }
        //public CanvasGroup tooltip;
        public UnityEngine.UI.Text tooltipText;
 
        void Awake() {
            instance = this;
            HideTooltip();
        }
 
        public void ShowTooltip(string text, Vector3 pos) {
            if (tooltipText.text != text)
                tooltipText.text = text;
 
            transform.position = pos;
 
            gameObject.SetActive(true);
        }
         
        public void HideTooltip() {
            gameObject.SetActive(false);
        }
         
        // Standard Singleton Access 
        private static TooltipView instance;
        public static TooltipView Instance
        {
            get
            {
                if (instance == null)
                    instance = GameObject.FindObjectOfType<TooltipView>();
                return instance;
            }
        }
    }
}

 

Vertex_Shader