public void Use(InteractManager interactManager) { if (locked) { IContainer container = interactManager.GetComponentInChildren <IContainer>(); if (container != null) { IItem[] items = container.Items; foreach (IItem item in items) { ItemStageKey key = item as ItemStageKey; if (key != null && key.StageValue == GameManager.Stage) { container.RemoveItem(key); GameObject.Destroy(key); Locked = false; return; } } } return; } GameManager.LoadStage(GameManager.Stage + delta); }
public void Use(InteractManager user, UsableArgs args = null) { Armor a = ScriptableObject.Instantiate(armorPrefab as ScriptableObject) as Armor; ArmorManager am = user.GetComponentInChildren <ArmorManager>(); switch (a.Slot) { case ArmorSlot.Head: am.Head = a; break; case ArmorSlot.Neck: am.Neck = a; break; case ArmorSlot.Shoulders: am.Shoulders = a; break; case ArmorSlot.Chest: am.Chest = a; break; case ArmorSlot.Back: am.Back = a; break; case ArmorSlot.Wirst: am.Wirst = a; break; case ArmorSlot.Hands: am.Hands = a; break; case ArmorSlot.Waist: am.Waist = a; break; case ArmorSlot.Legs: am.Legs = a; break; case ArmorSlot.Feets: am.Feets = a; break; case ArmorSlot.Ring: am.Ring = a; break; case ArmorSlot.Trinket: am.Trinket = a; break; } user.gameObject.GetComponentInChildren <IContainer>().RemoveItem(this); Destroy(this.gameObject); }
public void Use(InteractManager user, UsableArgs args = null) { if (transferUI != null) { transferUI.OpenUI(user.GetComponentInChildren <IContainer>(), this); } if (openClip != null) { AudioManager.PlaySfx(openClip, transform); } }
public void Use(InteractManager user, UsableArgs args = null) { IRangedWeaponAmmo a = ScriptableObject.Instantiate(ammo as ScriptableObject) as IRangedWeaponAmmo; WeaponManager wp = user.GetComponentInChildren <WeaponManager>(); wp.CurrentAmmos = a; if (ammoLeft >= 0) { a.AmmoLeft = ammoLeft; } user.gameObject.GetComponentInChildren <IContainer>().RemoveItem(this); Destroy(this.gameObject); }