Created
June 17, 2019 00:47
-
-
Save SocketWeaver/fd484ee950bc4744e8493a6754122f25 to your computer and use it in GitHub Desktop.
Update player firing state when left mouse button is released
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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