void Start() { character = (character == null) ? GetComponent <Character>() : character; ammo = (ammo == null) ? GetComponent <AmmoBelt>() : ammo; hud = (hud == null) ? GetComponentInChildren <HudManager>() : hud; character.PledgeAliegence(this); }
public void Load(AmmoBelt belt) { guid = belt.guid; for (int i = 0; i < belt.GetItems().Count; i++) { UIContainerSlot slot = new UIContainerSlot(belt, i); slot.CanInteract += (item, mouse) => mouse.IsAir || mouse.ammo > 0; gridItems.Add(slot); } }
public void UpdateAmmoDisplay(AmmoBelt ammo) { ammo_renderer.GetComponent <Image> ().sprite = ammo.ActiveAmmo().GetComponent <SpriteRenderer> ().sprite; ammo_text.GetComponent <TextMeshProUGUI> ().text = ammo.Available().ToString(); }