public void Add(PickUp pickup) { PickUp.Type type = pickup.type; if (type == PickUp.Type.Gem) { SceneSwitcher.instance.GoToScene("Congrats"); } else { int oldTotal = 0; if (items.TryGetValue(type, out oldTotal)) { items[type] = oldTotal + 1; } else { items.Add(type, 1); } inventoryDisplayer.OnChangeInventory(items); } if (PickUp.Type.Coin == type) { int currentCoins = 0; items.TryGetValue(type, out currentCoins); SceneSwitcher.instance.SetCoins(currentCoins); } }
public bool HasAtLeastOne(PickUp.Type type) { int value = 0; items.TryGetValue(type, out value); return(value > 0); }
public bool RemoveOne(PickUp.Type type) { if (HasAtLeastOne(type)) { items[type] -= 1; inventoryDisplayer.OnChangeInventory(items); return(true); } else { return(false); } }
public void PickUp(PickUp.Type type) { switch (type) { case global::PickUp.Type.PhaseStar: ammoType = AmmoType.Phase; specialAmmoCount = 5; phasePfx.Play(); break; case global::PickUp.Type.PhaseShield: StartShield(5.0f); break; default: throw new ArgumentOutOfRangeException("type", type, null); } }