예제 #1
0
        private void SendTouchEnded(Touch touch)
        {
            int num = touchControls.Length;

            for (int i = 0; i < num; i++)
            {
                TouchControl touchControl = touchControls[i];
                if (touchControl.enabled && touchControl.gameObject.activeInHierarchy)
                {
                    touchControl.TouchEnded(touch);
                }
            }
        }
예제 #2
0
        private void CommitControlStates(ulong updateTick, float deltaTime)
        {
            int num = touchControls.Length;

            for (int i = 0; i < num; i++)
            {
                TouchControl touchControl = touchControls[i];
                if (touchControl.enabled && touchControl.gameObject.activeInHierarchy)
                {
                    touchControl.CommitControlState(updateTick, deltaTime);
                }
            }
        }
        public override void SubmitControlState(ulong updateTick, float deltaTime)
        {
            Vector3 v = TouchControl.SnapTo(currentVector, snapAngles);

            SubmitAnalogValue(target, v, 0f, 1f, updateTick, deltaTime);
            SubmitButtonState(upTarget, fireButtonTarget && nextButtonTarget == upTarget, updateTick, deltaTime);
            SubmitButtonState(downTarget, fireButtonTarget && nextButtonTarget == downTarget, updateTick, deltaTime);
            SubmitButtonState(leftTarget, fireButtonTarget && nextButtonTarget == leftTarget, updateTick, deltaTime);
            SubmitButtonState(rightTarget, fireButtonTarget && nextButtonTarget == rightTarget, updateTick, deltaTime);
            SubmitButtonState(tapTarget, fireButtonTarget && nextButtonTarget == tapTarget, updateTick, deltaTime);
            if (fireButtonTarget && nextButtonTarget != 0)
            {
                fireButtonTarget = !oneSwipePerTouch;
                lastButtonTarget = nextButtonTarget;
                nextButtonTarget = ButtonTarget.None;
            }
        }
        private ButtonTarget GetButtonTargetForVector(Vector2 vector)
        {
            Vector2 lhs = TouchControl.SnapTo(vector, SnapAngles.Four);

            if (lhs == Vector2.up)
            {
                return(upTarget);
            }
            if (lhs == Vector2.right)
            {
                return(rightTarget);
            }
            if (lhs == -Vector2.up)
            {
                return(downTarget);
            }
            if (lhs == -Vector2.right)
            {
                return(leftTarget);
            }
            return(ButtonTarget.None);
        }
예제 #5
0
 public static void DetachControl(TouchControl touchControl)
 {
     touchControls.Remove(touchControl);
 }
예제 #6
0
 public static void AttachControl(TouchControl touchControl)
 {
     touchControls.Add(touchControl);
 }