コード例 #1
0
        public void Update()
        {
            // poll the static input manager for current input information
            bool?isNorth = InputManager.yAxis.Value == 0 ? null : (bool?)(InputManager.yAxis.Value < 0);
            bool?isWest  = InputManager.xAxis.Value == 0 ? null : (bool?)(InputManager.xAxis.Value < 0);

            previnputHeld = currInputHeld;
            currInputHeld = isNorth.HasValue || isWest.HasValue;

            // convert the directional input information into a Direction8
            var newDir = DirectionFromInput(isNorth, isWest);

            if (newDir.HasValue && (InputStart || prevDirection != newDir))
            {
                OnInputStart?.Invoke(newDir.Value);
            }
            prevDirection = newDir;
        }
コード例 #2
0
 public void InputStart()
 {
     OnInputStart?.Invoke();
 }