void Start() { player = GetComponent <Player>(); inventoryToSearch = GetComponent <InventoryToSearch>(); AddInInventory(headArmor); AddInInventory(chestArmor); AddInInventory(feetsArmor); AddInInventory(rightHandWeapon); AddInInventory(leftHandWeapon); AddInInventory(shield); if (rightHandSocket == null || leftHandSocket == null) { Debug.LogWarning(@"RightHandSocket or LeftHandSocket aren't correctly configured. Undefined bahavior can happen when equipping weapons. Please check your settings."); } Damageable damageable = GetComponent <Damageable>(); if (damageable != null) { damageable.onDamageTaken.AddListener(ApplyArmorOnDamage); } }
void Start() { InventoryToSearch inv = GetComponent <InventoryToSearch>(); int nbObj = (int)Random.Range(0, nbMaxItemsToCarry); for (int idx = 0; idx < nbObj; ++idx) { inv.AddItem(randomItem()); } }
private void CreateScroll() { if (playerAndMerchantsGenerator.CreatedPlayer.PlayerInventory.Items.ContainsKey(teleportationToStartZoneScroll)) { return; } if (chests.Chests.Count > 0) { InventoryToSearch chest = chests.Chests[Random.Range(0, chests.Chests.Count)].GetComponent <InventoryToSearch>(); chest.AddItem(teleportationToStartZoneScroll); } }
public IEnumerator CheckInventoryEmpty() { if (GetComponent <InventoryToSearch>()) { InventoryToSearch inv = GetComponent <InventoryToSearch>(); yield return(new WaitForSeconds(5f)); while (inv.Items.Count != 0) { yield return(new WaitForSeconds(5f)); } canBeDestroyed = true; if (!UIRoot.Instance.UIRootNonPlayer.Displayed) { Destroy(gameObject); } else { UIRoot.Instance.UIRootNonPlayer.inventoryDisplayChange += DestroyEnemy; } } }