コード例 #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);
                }
            }
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
        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);
 }