Skip to content

Instantly share code, notes, and snippets.

@SocketWeaver
Created June 17, 2019 00:47
Show Gist options
  • Save SocketWeaver/fd484ee950bc4744e8493a6754122f25 to your computer and use it in GitHub Desktop.
Save SocketWeaver/fd484ee950bc4744e8493a6754122f25 to your computer and use it in GitHub Desktop.
Update player firing state when left mouse button is released
void Update()
{
if (player.Dead || !networkID.IsMine)
{
return;
}
if (Input.GetKeyUp(KeyCode.Alpha1))
{
syncPropertyAgent.Modify(CURRENT_WEAPON, 0);
}
else if (Input.GetKeyUp(KeyCode.Alpha2))
{
syncPropertyAgent.Modify(CURRENT_WEAPON, 1);
}
if (Input.GetButton("Fire1"))
{
Guns[CurrentWeapon].Fire();
}
else
{
// Update player firing state when left mouse button is released
Guns[CurrentWeapon].StopFiring();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment