Beispiel #1
0
        // Update is called once per frame
        void FixedUpdate()
        {
            var currentPlayer = this.playerInputHandler.CharSelector.Selected.identifier;

            if (this.timeline.IsReverse)
            {
            }
            else
            {
                foreach (var c in commands)
                {
                    var f = this.playerInput.currentActionMap[c].ReadValue <float>();
                    commandDict[c] = f;
                    if (f > 0)
                    {
                        inputBuffer.AddInput(currentPlayer, new ButtonInput {
                            button_name = c, value = f
                        });
                    }
                }
                foreach (var c in vectorCommands)
                {
                    var v    = this.playerInput.currentActionMap[c].ReadValue <Vector2>();
                    var move = this.playerInputHandler.GetMove(v);
                    commandDict[c] = move;
                    if (move.magnitude > 0)
                    {
                        inputBuffer.AddInput(currentPlayer, new MoveInput {
                            move = move
                        });
                    }
                }
            }
        }
Beispiel #2
0
        public void OnLook(InputValue v)
        {
            var value          = v.Get <Vector2>();
            var headingRight   = value.x * cameraRight;
            var headingForward = value.y * cameraForward;

            heading = (headingForward + headingRight).normalized * value.magnitude;
            var look = new LookInput {
                look = heading
            };

            inputBuffer.AddInput(CharSelector.SelectedCharacter, look);
        }