perf: Check If Inputs Have Been Listened On
This commit is contained in:
parent
d60537f940
commit
44bee2df08
|
@ -59,16 +59,26 @@ public class KeyboardInputsBehaviour : BehaviourOverride, IKeyboardInputs
|
|||
for (int i = 0; i < cachePressedCurrentlyCount; i++)
|
||||
{
|
||||
Keys currentlyPressedKey = cachePressedCurrently[i];
|
||||
if (!WasPressed(currentlyPressedKey))
|
||||
if (OnPressed.TryGetValue(currentlyPressedKey, out var action))
|
||||
|
||||
if (!OnPressed.TryGetValue(currentlyPressedKey, out var action))
|
||||
continue;
|
||||
|
||||
if (WasPressed(currentlyPressedKey))
|
||||
continue;
|
||||
|
||||
action.Invoke(this, currentlyPressedKey);
|
||||
}
|
||||
|
||||
for (int i = 0; i < cachePressedPreviouslyCount; i++)
|
||||
{
|
||||
Keys previouslyPressedKey = cachePressedPreviously[i];
|
||||
if (!IsPressed(previouslyPressedKey))
|
||||
if (OnReleased.TryGetValue(previouslyPressedKey, out var action))
|
||||
|
||||
if (!OnReleased.TryGetValue(previouslyPressedKey, out var action))
|
||||
continue;
|
||||
|
||||
if (IsPressed(previouslyPressedKey))
|
||||
continue;
|
||||
|
||||
action.Invoke(this, previouslyPressedKey);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue