Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function reloadMagazine () {
- var playerAmmo = player.GetComponent(playerVariables).playerAmmo;
- //if (playerAmmo < 1) {Debug.Log("No Ammo");}
- if (isShooting) {return;}
- //exit if you are reloading or you are using your weapon action
- if (isReloading == true || isWeaponAction == true) {return;}
- //if you have no Ammo or if you have a full magazine;
- if (playerAmmo == 0 || currentMagazineAmmo == currentMagazine) {return;}
- isReloading = true;
- if (isIncremental) {
- while(currentMagazineAmmo < currentMagazine && playerAmmo > 0) {
- //Load Shotgun incrementally.
- animator.SetTrigger("isReloadInc");
- }
- } else {
- while(currentMagazineAmmo < currentMagazine && playerAmmo > 0) {
- ++currentMagazineAmmo;
- --player.GetComponent(playerVariables).playerAmmo;
- }
- }
- if (currentMagazineAmmo > 0) {
- //Partial Reload
- animator.SetTrigger("isReloadPartial");
- } else {
- //Full Reload
- animator.SetTrigger("isReloadFull");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement