예제 #1
0
        static public GazeCursorBase Instance()
        {
            if (_instance == null)
            {
                GameObject go = GameObject.Find("GazeCursor");
                if (go)
                {
                    _instance = go.GetComponent <GazeCursorBase>();
                }
            }

            return(_instance);
        }
예제 #2
0
        protected void UpdateLocalDistanceFromTarget(GazeTarget target)
        {
            Vector3 targetLocalPosition = new Vector3(target.Position.x, target.Position.y, target.Position.z);

            if (Vector3.zero.Equals(targetLocalPosition))
            {
                //Debug.Log("target Position is zero : ");
                if (target.Target != null)
                {
                    targetLocalPosition = new Vector3(target.Target.transform.position.x,
                                                      target.Target.transform.position.y,
                                                      target.Target.transform.position.z);
                }
            }

            float tmpDistance = Vector3.Distance(GazeCursorBase.Instance().transform.position, targetLocalPosition);

            _distance = Mathf.Clamp(tmpDistance, _minDistance, _maxDistance);
        }