Пример #1
0
        private Touch[] GetCurrentMouseTouches()
        {
            Touch[] mouseTouches = null;
            bool    isDown       = AppInput.GetKeyDown(KCode.Mouse0);  //Input.GetMouseButtonDown(0);
            bool    isButton     = AppInput.GetKey(KCode.Mouse0);      //Input.GetMouseButton(0);

            if (isButton && (_currentTouches == null || _currentTouches.Length == 0))
            {
                isDown = true;
            }
            if (isButton || isDown)
            {
                if (isDown)
                {
                    mousePosition = AppInput.MousePosition;
                }
                bool isStationary = mousePosition == AppInput.MousePosition;
                mouseTouches = new Touch[] { new Touch {
                                                 fingerId      = 0, rawPosition = AppInput.MousePosition, position = AppInput.MousePosition,
                                                 deltaPosition = AppInput.MousePosition - mousePosition,
                                                 phase         = (isDown) ? TouchPhase.Began : ((isStationary) ? TouchPhase.Stationary : TouchPhase.Moved),
                                             } };
                mousePosition = AppInput.MousePosition;
            }
            return(mouseTouches);
        }
Пример #2
0
 private void Update()
 {
     if (follower == null && characterToMove.Target != null)
     {
         SetFollower(characterToMove.Target.move);
     }
     if (follower == null)
     {
         return;
     }
     if (AppInput.GetKey(key))
     {
         RaycastClick(rh => ClickFor(follower, rh));
     }
     if (prefab_waypoint != null && AppInput.GetKeyUp(key))
     {
         follower.ShowCurrentWaypoint();
     }
 }
Пример #3
0
 private void Update()
 {
     if (selection.Count == 0 && c2m.characterToMove.Target != null)
     {
         SetSelection(c2m.characterToMove.Target);
     }
     if (AppInput.GetKey(c2m.key))
     {
         c2m.RaycastClick(rh => {
             if (selection.Count == 0)
             {
                 return;
             }
             for (int i = 0; i < selection.Count; ++i)
             {
                 if (selection[i] == null)
                 {
                     selection.RemoveAt(i--);
                     continue;
                 }
                 c2m.ClickFor(selection[i], rh);
             }
         });
     }
     if (c2m.prefab_waypoint != null && AppInput.GetKeyUp(c2m.key))
     {
         //if (follower != null) { follower.ShowCurrentWaypoint(); }
         if (selection.Count > 0)
         {
             for (int i = 0; i < selection.Count; ++i)
             {
                 selection[i].ShowCurrentWaypoint();
             }
         }
     }
 }