We're now starting to get this to work with the ammo pickups! Still some work...

We're now starting to get this to work with the ammo pickups!  Still some work to do with it though.  Almost done!
parent e8524328
......@@ -80,6 +80,7 @@ public class WeaponSwapScript : MonoBehaviour
if (previousSelectedWeapon != selectedWeapon)
{
SelectWeapon();
AddAmmo(selectedWeapon, 22);
}
}
......@@ -90,11 +91,24 @@ public class WeaponSwapScript : MonoBehaviour
int x = 0; //the 'iterator' of the foreach loop
foreach (Transform weapon in transform)
{
if (x == selectedWeapon) //if this is the weapon the player wants, then it becomes true.
if (x == selectedWeapon)//if this is the weapon the player wants, then it becomes true.
weapon.gameObject.SetActive(true);
else //if this weapon is NOT what the player wants, then it becomes false.
weapon.gameObject.SetActive(false);
x++;
}
}
public void AddAmmo(int ammoType, int ammoToGivePlayer)
{
int x = 0;
foreach (Transform weapon in transform)
{
if(x == ammoType)
{
weapon.GetComponent<GunScript>().ammo+=ammoToGivePlayer;
}
x++;
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment