// enemies and objects that offer bonus items should call this function public GameObject GetBonusItem(ItemScript.ItemTypes itemType) { GameObject bonusItem = null; // pick a random bonus item if (itemType == ItemScript.ItemTypes.Random) { itemType = PickRandomBonusItem(); } // get bonus item prefab from type switch (itemType) { case ItemScript.ItemTypes.Nothing: bonusItem = null; break; case ItemScript.ItemTypes.BonusBall: bonusItem = assetPalette.itemPrefabs[(int)AssetPalette.ItemList.BonusBall]; break; case ItemScript.ItemTypes.ExtraLife: bonusItem = assetPalette.itemPrefabs[(int)AssetPalette.ItemList.ExtraLife]; break; case ItemScript.ItemTypes.LifeEnergyBig: bonusItem = assetPalette.itemPrefabs[(int)AssetPalette.ItemList.LifeEnergyBig]; break; case ItemScript.ItemTypes.LifeEnergySmall: bonusItem = assetPalette.itemPrefabs[(int)AssetPalette.ItemList.LifeEnergySmall]; break; case ItemScript.ItemTypes.WeaponEnergyBig: bonusItem = assetPalette.itemPrefabs[(int)AssetPalette.ItemList.WeaponEnergyBig]; break; case ItemScript.ItemTypes.WeaponEnergySmall: bonusItem = assetPalette.itemPrefabs[(int)AssetPalette.ItemList.WeaponEnergySmall]; break; case ItemScript.ItemTypes.MagnetBeam: bonusItem = assetPalette.itemPrefabs[(int)AssetPalette.ItemList.MagnetBeam]; break; case ItemScript.ItemTypes.WeaponPart: bonusItem = assetPalette.itemPrefabs[(int)AssetPalette.ItemList.WeaponPart]; break; case ItemScript.ItemTypes.Yashichi: bonusItem = assetPalette.itemPrefabs[(int)AssetPalette.ItemList.Yashichi]; break; } // return bonus item prefab return(bonusItem); }
public void SetBonusItemType(ItemScript.ItemTypes itemType) { // set bonus item type this.bonusItemType = itemType; }