Exemple #1
0
 // Decrement the ammo available upon firing.
 void DecrementAmmo(WeaponPackage weaponInfo)
 {
     currentAmmo[weaponInfo.weaponType] -= weaponInfo.ammoAmount;	// I could combine the two functions,
                                                                     // but for readability i'll keep them
                                                                     // seperate.
 }
Exemple #2
0
 // Select the next available weapon
 // void ChangeWeapon()
 // {
 //Cycle through available weapons
 //if( Input.GetKeyUp("f") )
 // scroll = Input.GetAxis("Mouse ScrollWheel");
 // if( scroll > 0 || Input.GetKeyUp("f") )
 // {
 // ++currentWeapon;
 // if(currentWeapon == (int)Weapons.WEAPONS_MAX)
 // currentWeapon = 0;
 // while(weaponOwned[currentWeapon] == false)
 // {
 // ++currentWeapon;
 // if(currentWeapon == (int)Weapons.WEAPONS_MAX)
 // currentWeapon = 0;
 // }
 // }
 // else if( scroll < 0 || Input.GetKeyUp("f") )
 // {
 // --currentWeapon;
 // if(currentWeapon < 0)
 // currentWeapon = (int)Weapons.WEAPONS_MAX - 1;
 // while(weaponOwned[currentWeapon] == false)
 // {
 // --currentWeapon;
 // if(currentWeapon < 0)
 // currentWeapon = (int)Weapons.WEAPONS_MAX - 1;
 // }
 // }
 // }
 // Display the appropriate weapon
 // void DisplayWeaponAvatar()
 // {
 // GameObject weapon;
 // if(!weaponOwned[currentWeapon])
 // {
 // currentWeapon = prevWeapon;
 // }
 // switch(currentWeapon)
 // {
 // case (int)Weapons.ROCKET_LAUNCHER:
 // weapon = GameObject.Find("AvatarRocketLauncher");
 // weapon.renderer.enabled = true;
 // weapon = GameObject.Find("AvatarTNTDetonator");
 // if(weapon != null)
 // weapon.renderer.enabled = false;
 // prevWeapon = (int)Weapons.ROCKET_LAUNCHER;
 // break;
 // case (int)Weapons.SONIC_CHARGE:
 // break;
 // case (int)Weapons.TNT:
 // weapon = GameObject.Find("AvatarRocketLauncher");
 // weapon.renderer.enabled = false;
 // weapon = GameObject.Find("AvatarTNTDetonator");
 // if (weapon != null)
 // weapon.renderer.enabled = true;
 // prevWeapon = (int)Weapons.TNT;
 // break;
 // default:
 // break;
 // };
 // }
 // void WeaponPickup(WeaponPackage weaponInfo)
 // {
 //If we don't own the weapon, do everything necessary to own and equip it.
 // if(weaponOwned[weaponInfo.weaponType] == false)
 // {
 //Equip new weapon upon picking it up
 // weaponOwned[weaponInfo.weaponType] = true;     		// Signify that we now own this weapon
 // currentAmmo[weaponInfo.weaponType] = weaponInfo.ammoAmount;        // Give two rockets to start out
 // currentWeapon = weaponInfo.weaponType;         		// Update the currently equipt weapon
 // }
 // else  // Otherwise, award player with some more ammo for said weapon
 // {
 // currentAmmo[weaponInfo.weaponType] += weaponInfo.ammoAmount;
 // }
 // }
 // Increment ammo upon picking up ammo.
 void IncrementAmmo(WeaponPackage weaponInfo)
 {
     currentAmmo[weaponInfo.weaponType] += weaponInfo.ammoAmount;
 }