I create script, where Player can Press Key(0-9) and chose Weapon. Is there any way to do this conditions in one loop using Array?
if (Input.GetKey(KeyCode.Alpha1))
{
} /// Alpha1 Alpha2... ...Alpha9
else if (Input.GetKey(KeyCode.Alpha9))
{
}
Something like that:
for (int i=0; i< maxWeapons; i++)
{
if (Input.GetKey(KeyCode.Array[i]))
{
} /// Alpha1 Alpha2... ...Alpha9
else if (Input.GetKey(KeyCode.Array[i]))
{
}
}
But I don’t know what Type Array I need here
Thx for answers