コード例 #1
0
    private void CheckInput()
    {
        if (Input.anyKey)
        {
            foreach (string currentAxis in InputAxis.AxisList)
            {
                float axisValue = Input.GetAxisRaw(currentAxis);

                if (axisValue != 0)
                {
                    InputCommand commandToExecute =
                        InputConfiguration.GetCommandByAxisName(currentAxis);
                    GameEntity inputEntity = _context.CreateEntity();
                    if (commandToExecute != InputCommand.Undefined)
                    {
                        inputEntity.AddInput(commandToExecute, axisValue);
                    }
                    else
                    {
                        inputEntity.AddInput(InputCommand.None, 0f);
                    }
                }
            }
        }
        else
        {
            GameEntity inputEntity = _context.CreateEntity();
            inputEntity.AddInput(InputCommand.None, 0f);
        }
    }