/// <summary> /// Function called at the creation of the player UI to let the script know which player it is for. /// </summary> /// <param name="player"></param> public void SetPlayerTarget(GameObject player) { this.player = player; playerInventory = this.player.GetComponentInChildren <InventoryScript>(); playerManager = this.player.GetComponentInChildren <PlayerManager>(); inventorySlotNames = playerInventory.GetAllInventorySlotNames(); }
// Use this for initialization private void Start() { inventory = weaponInventory.GetComponent <InventoryScript>(); if (inventory == null) { Debug.LogError("No InventoryScript found on this player: " + this.name); return; } weaponsEquipped = new List <string>(); weapons = new List <GameObject>(); inventorySlotStrings = inventory.GetAllInventorySlotNames(); SetNonNullWeaponsFromInventory(); currentWeaponIndex = 0; previousWeaponIndex = currentWeaponIndex; amidstInventoryStuff = false; Debug.Log("Weapon manager start " + this.name); }