Exemplo n.º 1
0
    private void FixedUpdate()
    {
        UpdateActiveInputs();

        foreach (InputAction inputAction in ReInput.mapping.Actions)
        {
            string name = inputAction.name;
            if (inputAction.type == InputActionType.Axis)
            {
                float value;
                if (activeInputs.ContainsKey(name))
                {
                    TASInput input = activeInputs[name];
                    value = input.Value;
                    input.TimeToLive--;
                }
                else
                {
                    value = 0.0f;
                }
                InputBuffer.Instance.InputAxis(name, value);
            }
            else if (inputAction.type == InputActionType.Button)
            {
                bool held, down, up;
                if (activeInputs.ContainsKey(name))
                {
                    TASInput input = activeInputs[name];

                    held = true;
                    down = input.IsFirst();
                    up   = (input.TimeToLive == 1);

                    input.TimeToLive--;
                }
                else
                {
                    held = false;
                    down = false;
                    up   = false;
                }

                InputBuffer.Instance.InputButton(name, held, down, up);
            }
        }
    }