void checkInput() { InputState inputState = _input.GetInput(); if (inputState.Fire) { if (curWeapon != null && timeToFire >= curWeaponScript.delay) { GameObject g = Instantiate <GameObject>(curWeapon); Weapon weaponScript = g.GetComponentInChildren <Weapon>(); weaponScript.fire(spawnLocations[weapons.IndexOf(curWeapon)].position); timeToFire = 0f; } } else if (inputState.SelectNextWeapon) { if (curWeapon != null) { curWeapon = weapons[(weapons.IndexOf(curWeapon) + 1) % numOfWeapons]; } } else if (inputState.SelectPrevWeapon) { if (curWeapon != null) { curWeapon = weapons[(weapons.IndexOf(curWeapon) - 1) % numOfWeapons]; } } }