Beispiel #1
0
 internal static TouchRayEvent GetInstance()
 {
     if (instance == null)
     {
         GameObject go = new GameObject("TouchRayEvent");
         instance = go.AddComponent <TouchRayEvent> ();
     }
     return(instance);
 }
        void Start()
        {
            TouchRayEvent.GetInstance().AddListen(target.gameObject, true, false, false);
            CanvasScaler canvasScaler = GameObject.FindObjectOfType <CanvasScaler> ();

            ratio = canvasScaler.referenceResolution.y / (float)Screen.height;
            if (!target)
            {
                target = transform;
            }
            if (!parent)
            {
                parent = new GameObject("parent").transform;
                parent.SetParent(target.parent);
                parent.localPosition    = Vector3.zero;
                parent.localEulerAngles = Vector3.zero;
                parent.localScale       = Vector3.one;
                target.SetParent(parent);
            }
        }
 void OnDestory()
 {
     TouchRayEvent.GetInstance().RemoveListen(target.gameObject);
 }
Beispiel #4
0
 void OnDestory()
 {
     instance = null;
 }