refactor: Reading all inputs from a single method

This commit is contained in:
Gerard Gascón 2024-04-16 16:47:27 +02:00
parent 3e31ecc943
commit c1a8b06f43
2 changed files with 22 additions and 40 deletions

View file

@ -26,34 +26,16 @@ namespace View.UI {
CheckInput();
}
private void CheckInput() {
_customInput.UpdateInput();
if (_customInput.KeyDown(typeof(GeminadaReader)))
_click.Execute();
if (_customInput.KeyDown(typeof(CedillaReader)))
_click.Execute();
if (_customInput.KeyDown(typeof(IxReader)))
_click.Execute();
if (_customInput.KeyDown(typeof(LlReader)))
_click.Execute();
if (_customInput.KeyDown(typeof(NyReader)))
_click.Execute();
if (_customInput.KeyDown(typeof(SsReader)))
_click.Execute();
if (_customInput.KeyDown(typeof(TgReader)))
_click.Execute();
if (_customInput.KeyDown(typeof(TjReader)))
_click.Execute();
if (_customInput.KeyDown(typeof(TxReader)))
_click.Execute();
if(_customInput.KeyDown(typeof(AObertaReader)))
_click.Execute();
}
public void UpdateView(int score) {
animator.PlayUntil(_model.GrowPercentage);
text.text = score.ToString();
}
private void CheckInput() {
_customInput.UpdateInput();
if (_customInput.AnyKeyDown())
_click.Execute();
}
}
}