public override bool SearchEvent(List <TouchData> touchDatas, float tDelta)
        {
            Vector3 vecMove   = Vector3.zero;
            bool    isJumping = false;

            foreach (TouchData td in touchDatas)
            {
                if (UtilityInput.IsPointOverAlpha(buttons[0], td.position))
                {
                    vecMove.x--;
                }
                if (UtilityInput.IsPointOverAlpha(buttons[1], td.position))
                {
                    vecMove.x++;
                }
                if (UtilityInput.IsPointOverAlpha(buttons[2], td.position))
                {
                    isJumping = true;
                }
            }

            if (vecMove != Vector3.zero || isJumping)
            {
                vecMove.Normalize();
                (reciever as IEventHandlerThreeStick).OnButtonPress(vecMove, isJumping);
                return(true);
            }

            return(false);
        }
 public override bool IsTouchRelevant(TouchData td)
 {
     foreach (Image image in images)
     {
         if (UtilityInput.IsPointOverAlpha(image, td.position))
         {
             return(true);
         }
     }
     return(false);
 }
        public override bool SearchEvent(List <TouchData> touchDatas, float tDelta)
        {
            Vector3 vecMove = Vector3.zero;

            foreach (TouchData td in touchDatas)
            {
                if (UtilityInput.IsPointOverAlpha(images[0], td.position))
                {
                    vecMove.z++;
                }
                if (UtilityInput.IsPointOverAlpha(images[1], td.position))
                {
                    vecMove.z--;
                }
                if (UtilityInput.IsPointOverAlpha(images[2], td.position))
                {
                    vecMove.x++;
                }
                if (UtilityInput.IsPointOverAlpha(images[3], td.position))
                {
                    vecMove.x--;
                }
                if (UtilityInput.IsPointOverAlpha(images[4], td.position))
                {
                    vecMove.y++;
                }
                if (UtilityInput.IsPointOverAlpha(images[5], td.position))
                {
                    vecMove.y--;
                }
            }

            if (vecMove != Vector3.zero)
            {
                vecMove.Normalize();
                (reciever as IEventHandlerVirtualJoystick).OnMoveSixAxis(vecMove);
                return(true);
            }

            return(false);
        }
Пример #4
0
        public override bool SearchEvent(List <TouchData> touchDatas, float tDelta)
        {
            bool foundMove = false;

            foreach (TouchData td in touchDatas)
            {
                if
                (
                    UtilityInput.IsPointOverAlpha(plate, td.position) &&
                    UtilityInput.IsPointOverAlpha(plate, td.posOrigin) &&
                    (td.phasePointer == PhasePointer.MOVED || td.phasePointer == PhasePointer.STATIC)
                )
                {
                    foundMove = true;
                    if (td.phasePointer == PhasePointer.MOVED)
                    {
                        Vector3 vecPrev       = td.posPrev;
                        Vector3 vecNow        = td.position;
                        Vector2 vecPrevScreen = Camera.main.WorldToScreenPoint(vecPrev);
                        Vector2 vecNowScreen  = Camera.main.WorldToScreenPoint(vecNow);

                        Vector2 vecDelta = vecNow - vecPrev; // vecNowScreen - vecPrevScreen;
                        vecDeltaCamera += vecDelta;
                    }
                }
            }

            if (!foundMove)
            {
                vecDeltaCamera = Vector2.zero;
            }

            Debug.Log("found " + foundMove + touchDatas.Count);

            if (isNotifier)
            {
                (reciever as IEventHandlerSnapPlate).OnMoved(vecDeltaCamera);
            }

            return(true);
        }
 public override bool IsTouchRelevant(TouchData td)
 {
     return(UtilityInput.IsPointOverAlpha(maskOverlay, td.position));
 }
 public override bool IsTouchRelevant(TouchData td)
 {
     // better radius max for quit
     // started over image
     return(UtilityInput.IsPointOverAlpha(imgBack, td.posOrigin));
 }
 public override bool IsTouchRelevant(TouchData td)
 {
     return(UtilityInput.IsPointOverAlphas(buttons, td.position));
 }