void UseBonus(PickupBonus temp) { SetBonusData(temp); if (temp.Type == BonusType.Ammo) { _guns [(int)temp.AmmoType].AmmoQuantity += (int)temp.Quantity; SetActiveGun(_currentGunIndex); } else { if (temp.Type == BonusType.Health) { _hpQuantity++; if (UIController.Instance) { UIController.Instance.SetHP(_hpQuantity); } //_healthComponent.CurrentLifeValue += temp.Quantity; } else { _cargoQuantity++; if (UIController.Instance) { UIController.Instance.SetCargo(_cargoQuantity); } print("cargo recieved"); } } temp.gameObject.SetActive(false); }
void SetBonusData(PickupBonus bonus) { if (!bonus) { return; } if (UIController.Instance) { UIController.Instance.AddMessage(string.Format("Bonus {0}{1}{2}", bonus.Type, (bonus.Type == BonusType.Ammo ? bonus.AmmoType.ToString() : string.Empty), bonus.Quantity)); } }
public override void OnInspectorGUI() { PickupBonus bonus = target as PickupBonus; if (bonus == null) { return; } bonus.Type = (BonusType)EditorGUILayout.EnumPopup("Type:", bonus.Type); if (bonus.Type == BonusType.Ammo) { bonus.AmmoType = (AmmoType)EditorGUILayout.EnumPopup("Ammo type:", bonus.AmmoType); } bonus.Quantity = EditorGUILayout.FloatField("Quantity", bonus.Quantity); }
void TempBonus_OnBonusGet(PickupBonus obj) { obj.OnBonusGet -= TempBonus_OnBonusGet; AddNewBonus(); }