static public void Add(ObjectFocus objectFocus)
 {
     if (Instance.objectsInRange.Contains(objectFocus))
     {
         return;
     }
     Instance.objectsInRange.Add(objectFocus);
 }
    public static void Add(ObjectFocus objectToAdd)
    {
        //Prevents adding more objects into the ObjectFocus List.
        if (Instance.objectsInRange.Contains(objectToAdd))
        {
            return;
        }

        Instance.objectsInRange.Add(objectToAdd);
    }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        if (ObjectFocusManager.Instance.firstInList != null)
        {
            if (ObjectFocusManager.Instance.firstInList.isTrigger)
            {
                if (ObjectFocusManager.Instance.firstInList.Equals(lastObjectFocus))
                {
                    timer += Time.deltaTime;
                    onTouchTimerUpdate.Invoke(timerUpdateCurve.Evaluate(Mathf.InverseLerp(0, delay, timer)));
                    if (timer > delay)
                    {
                        onTouchTimerEnd.Invoke();
                    }
                }
                else
                {
                    onTouchCancel.Invoke();
                    timer = 0;
                    onTouch.Invoke();
                    lastObjectFocus = ObjectFocusManager.Instance.firstInList;
                }
            }
        }
        else
        {
            onTouchCancel.Invoke();
            timer = 0;
        }


        /*if (Input.touchCount > 0)
         * {
         * switch (Input.touches[0].phase)
         * {
         *  case TouchPhase.Began:
         *      timer = 0;
         *      onTouch.Invoke();
         *      break;
         *  case TouchPhase.Ended:
         *      onTouchCancel.Invoke();
         *      break;
         *  default:
         *      timer += Time.deltaTime;
         *      onTouchTimerUpdate.Invoke(timerUpdateCurve.Evaluate(Mathf.InverseLerp(0, delay, timer)));
         *      if(timer > delay)
         *      {
         *          onTouchTimerEnd.Invoke();
         *      }
         *      break;
         * }
         * }*/
    }
 static public void Remove(ObjectFocus objectFocus)
 {
     Instance.objectsInRange.Remove(objectFocus);
 }