Advertisement
Guest User

Untitled

a guest
Mar 16th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. function reloadMagazine () {
  2. var playerAmmo = player.GetComponent(playerVariables).playerAmmo;
  3. //if (playerAmmo < 1) {Debug.Log("No Ammo");}
  4. if (isShooting) {return;}
  5. //exit if you are reloading or you are using your weapon action
  6. if (isReloading == true || isWeaponAction == true) {return;}
  7. //if you have no Ammo or if you have a full magazine;
  8. if (playerAmmo == 0 || currentMagazineAmmo == currentMagazine) {return;}
  9. isReloading = true;
  10. if (isIncremental) {
  11. while(currentMagazineAmmo < currentMagazine && playerAmmo > 0) {
  12. //Load Shotgun incrementally.
  13. animator.SetTrigger("isReloadInc");
  14.  
  15. }
  16.  
  17. } else {
  18. while(currentMagazineAmmo < currentMagazine && playerAmmo > 0) {
  19. ++currentMagazineAmmo;
  20. --player.GetComponent(playerVariables).playerAmmo;
  21. }
  22. }
  23. if (currentMagazineAmmo > 0) {
  24. //Partial Reload
  25. animator.SetTrigger("isReloadPartial");
  26. } else {
  27. //Full Reload
  28. animator.SetTrigger("isReloadFull");
  29. }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement