Roses/Assets/Scripts/Domain/CustomInput.cs
2024-04-14 23:15:50 +02:00

26 lines
No EOL
652 B
C#

using System;
using System.Collections.Generic;
using Domain.Input;
namespace Domain {
public class CustomInput {
private readonly Dictionary<Type, InputReader> _readers = new();
private readonly KeyHistory _history;
public CustomInput() {
_history = new KeyHistory();
_readers.Add(typeof(CedillaReader), new CedillaReader());
_readers.Add(typeof(GeminadaReader), new GeminadaReader(_history));
}
public void UpdateInput() {
_history.CheckPresses();
foreach (KeyValuePair<Type, InputReader> reader in _readers) {
reader.Value.UpdateInput();
}
}
public bool KeyDown(Type key) => _readers[key].KeyDown();
}
}