Graphics Reference
In-Depth Information
// store a reference to the gameObject in an ArrayList
weaponSlots.Add( TEMPgameObject );
// grab a reference to the weapon script attached to
// the weapon and store the reference in an ArrayList
TEMPWeapon= TEMPgameObject.GetComponent<BaseWeapon
Script>();
weaponScripts.Add( TEMPWeapon );
// disable the weapon
TEMPgameObject.SetActive( false );
}
// now we set the default selected weapon to visible
SetWeaponSlot(0);
}
public void SetOwner(int aNum)
{
// used to identify the object firing, if required
ownerNum= aNum;
}
public virtual void SetWeaponSlot (int slotNum)
{
// if the selected weapon is already this one, drop out!
if(slotNum==lastSelectedWeaponSlot)
return;
// disable the current weapon
DisableCurrentWeapon();
// set our current weapon to the one passed in
selectedWeaponSlot= slotNum;
// make sure sensible values are getting passed in
if(selectedWeaponSlot<0)
selectedWeaponSlot= weaponSlots.Count-1;
// make sure that the weapon slot isn't higher than the
// total number of weapons in our list
if(selectedWeaponSlot>weaponSlots.Count-1)
selectedWeaponSlot=weaponSlots.Count-1;
// we store this selected slot to use to prevent duplicate
// weapon slot setting
lastSelectedWeaponSlot= selectedWeaponSlot;
Search WWH ::




Custom Search