Inputs / Controls
Find input calls inside FlashlightController & FlashlightInteractor script you will find a method called:
FlashlightInteractor (Line 50)
[Header("Pickup Input")]
[SerializeField] private KeyCode pickupKey = KeyCode.Mouse0; // Key used to pick up flashlight items
// Handle input to pick up the flashlight item
if (interactiveItem != null)
{
if (Input.GetKeyDown(pickupKey))
{
interactiveItem.ObjectInteract(); // Call item's interaction logic
}
}Flashlight Controller
[Header("Flashlight Controller Inputs")]
[SerializeField] private KeyCode flashlightSwitch = KeyCode.F; // Turn flashlight on/off
[SerializeField] private KeyCode reloadBattery = KeyCode.R; // Reload battery input
[SerializeField] private KeyCode toggleFlashlightInv = KeyCode.Tab; // Toggle flashlight UIvoid PlayerInput()
{
if (Input.GetKeyDown(flashlightSwitch))
{
FlashlightSwitch(); // Turn flashlight on/off
}
if (!infiniteFlashlight)
{
// Hold to reload battery
if (Input.GetKey(reloadBattery) && batteryCount >= 1)
{
ReplaceBattery();
}
else
{
CoolDownTimer(); // Slowly resets timer if player stops holding reload
}
if (Input.GetKeyUp(reloadBattery))
{
shouldUpdate = true; // Begin cooldown to reset reload timer
}
}
if (Input.GetKeyDown(toggleFlashlightInv))
{
ToggleInventory();
}
}Last updated
Was this helpful?