protected override void AfterOnStartLocalPlayer() { /* Get the toolbelt manager from the player */ toolbeltManager = GetComponent <PlayerToolbeltManager>(); if (toolbeltManager == null) { throw new System.Exception("Why does this VR player not have a toolbelt!"); } /* Get the inventory manager for this player */ playerInventory = GetComponent <PlayerInventoryManager>(); if (playerInventory == null) { throw new System.Exception("Why is there no player inventory manager for this player?"); } /* Get the bank manager for this player */ playerBank = GetComponent <PlayerBankManager>(); if (playerBank == null) { throw new System.Exception("Why is there no player bank manager for this player?"); } /* Get the relic menu object */ RelicUIManager relicUI = inventoryMenuObj.GetComponent <RelicUIManager>(); Debug.Assert(relicUI != null); relicUI.SetPlayerInventory(playerInventory.GetInventory()); /* Get the bank menu object */ BankUIManager bankUI = bankMenuObj.GetComponent <BankUIManager>(); Debug.Assert(bankUI != null); bankUI.SetPlayerBankManager(playerBank); }
public void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { List <ItemInformation> ConsumedItems = new List <ItemInformation>(); foreach (ItemInformation itemRequired in itemsRequired) { if (PlayerInventoryManager.IsThisItemInInventory(itemRequired)) { ConsumedItems.Add(itemRequired); int index = itemsRequired.IndexOf(itemRequired); requirementCanvas.greenBorders[index].gameObject.SetActive(true); } } foreach (ItemInformation itemConsumed in ConsumedItems) { itemsRequired.Remove(itemConsumed); } if (itemsRequired.Count == 0) { Destroy(blockade, 2f); Destroy(gameObject, 2f); } } }
// Start is called before the first frame update void Start() { _animator = GetComponentInChildren <Animator>(); _healthBar = GetComponentInChildren <HealthBar>(); _currentHealth = gameObject.CompareTag("Player") ? PlayerInventoryManager.FindPlayerAttributeMaxValueByName("Health") : _currentHealth; _maxHealth = _currentHealth; _isDead = false; }
// Use this for initialization void Start() { inventory.SetActive(false); player.GetComponent <PlayerController>().playerCanMove = true; itemBar.SetActive(true); itemBar.GetComponent <PlayerInventoryBar>().DisplayMenuBar(); EventSystem.current.GetComponent <AltStandaloneInputModule>().mouseCanClick = false; inventoryScript = player.GetComponent <PlayerInventoryManager>(); }
public void OnPointerClick() { InfoUpdater.EnterAction(null); storedItem.SetActive(true); storedItem.transform.position = PlayerInventoryManager.playerTransform.position; PlayerInventoryManager.onDropAction(this.item); Destroy(this.gameObject); }
public void Awake() { inventoryManager = this.GetComponent <PlayerInventoryManager>(); miningManager = this.GetComponent <MiningManager>(); if (_instance != null) { Debug.LogError("Multiple PlayerManager instances found! Overriding existing instance."); } _instance = this; }
internal PartyMember(TSPlayer player) { Player = player; Items = new PlayerInventoryManager(player); Variables = new Dictionary <string, object>(); QuestStatuses = new QuestStatusCollection(); SpawnTileX = Main.spawnTileX; SpawnTileY = Main.spawnTileY; }
private void Awake() { rb = GetComponent <Rigidbody>(); hs = GetComponent <HealthSystem>(); animator = GetComponent <Animator>(); enemyState = GetComponent <EnemyState>(); playerInventoryManager = GameUtility.Player.GetComponent <PlayerInventoryManager>(); groundedItemDropController = GetComponent <GroundedItemDropController>(); grenade = new InventoryItem(new ItemsBase()); }
public Player(Level level) : base(-1, level) { _chunksUsed = new Dictionary <Tuple <int, int>, ChunkColumn>(); Inventory = new PlayerInventoryManager(this); Level = level; Width = 0.6; Height = 1.62; Length = 0.6; IsOperator = false; }
private void Awake() { if (_instance != null && _instance != this) { Destroy(this.gameObject); } else { _instance = this; } }
public void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Ground") { Invoke("PlayOnGroundAnimation", 0.5f); } else if (collision.gameObject.tag == "Player") { PlayerInventoryManager.AddItemToInventory(this); Destroy(gameObject); } }
public Player(Level level) : base(-1, level) { _chunksUsed = new List <Tuple <int, int> >(); Inventory = new PlayerInventoryManager(this); Level = level; Width = 0.6; Height = 1.62; Length = 0.6; IsOperator = false; Loaded = false; }
private void Awake() { playerInventoryManager = FindObjectOfType <PlayerInventoryManager>(); slotIcons = new GameObject[slots.Length]; for (int i = 0; i < slotIcons.Length; i++) { slotIcons[i] = slots[i].GetChild(0).GetChild(0).GetChild(0).gameObject; Image currentImage = slotIcons[i].GetComponentInChildren <Image>(); if (currentImage.sprite == null) { slotIcons[i].SetActive(false); } } }
private void OnTriggerExit(Collider other) { PlayerInventoryManager playerInventory = other.GetComponent <PlayerInventoryManager>(); if (playerInventory != null && playerInventory.Inventory.keys.Count > 0) { if (opened) { CloseDoor(); } else { OnDoorClosed?.Invoke(false); } } }
public void TakeDamage(int damage) { if (damage <= 0 || _isDead) { return; } _currentHealth = _currentHealth - damage <= 0 ? 0 : _currentHealth - damage; if (gameObject.CompareTag("Player")) { PlayerInventoryManager.SetPlayerAttributeByName("Health", _currentHealth, SetType.CurrentValue); } _healthBar.SubFillBar(damage / _maxHealth * 100); if (gameObject.CompareTag("Player")) { _animator.Play("TakeDamage"); } }
/// <summary> /// Checks if this item can be crafted. /// </summary> public bool CanCraft(PlayerInventoryManager playerInventory) { if (recipe.OutputItem.ItemData.type == 0) //If output item is a weapon { if (playerInventory.HasWeapon(ItemConverter.ToInventoryWeapon(recipe.OutputItem)).contains) { return(false); } foreach (RecipeItem item in recipe.RequiredItems) { if (item.Item.ItemData.type == 0) // If weapon { var weaponData = playerInventory.HasWeapon(ItemConverter.ToInventoryWeapon(item.Item)); if (!weaponData.contains || weaponData.slotContained.ItemCount < item.RequiredItemCount) { return(false); } } else { var itemData = playerInventory.HasItem(item.Item); if (!itemData.contains || itemData.slotContained.ItemCount < item.RequiredItemCount) { return(false); } } } return(true); } else { foreach (RecipeItem item in recipe.RequiredItems) { var itemData = playerInventory.HasItem(item.Item); if (!itemData.contains || itemData.slotContained.ItemCount < item.RequiredItemCount) { return(false); } } return(true); } }
/// <summary> /// Checks if this item can be crafted and returns crafted item if possible. Calling CanCraft for checking manually is not recommended since it will be relatively expensive. /// </summary> public InventoryItem Craft(PlayerInventoryManager playerInventory) { if (CanCraft(playerInventory)) { foreach (RecipeItem item in recipe.RequiredItems) { if (item.Item.ItemData.type == 0) //If weapon { playerInventory.RemoveWeapon(ItemConverter.ToInventoryWeapon(item.Item)); } else { playerInventory.RemoveItem(item.Item, item.RequiredItemCount); } } return(recipe.OutputItem); } return(null); }
private void OnCollisionEnter(Collision collision) { PlayerInventoryManager playerInventory = collision.gameObject.GetComponent <PlayerInventoryManager>(); if (playerInventory != null && playerInventory.Inventory.keys.Count > 0) { if (!opened && playerInventory.Inventory.keys.Any(x => x.doorId == doorId)) { OpenDoor(); } else { OnDoorOpened?.Invoke(false); } } else { OnDoorOpened?.Invoke(false); } }
private void Awake() { weaponsObtained = new GameObject[4]; playerInventoryManager = GetComponent <PlayerInventoryManager>(); }
private void Start() { inventoryManager = GameObject.FindGameObjectWithTag("Managers").GetComponent <PlayerInventoryManager>(); }
void Start() { InputHandler.instance.attackActions["Primary"].performed += ctx => OnAttack(); playerInventoryManager = gameObject.GetComponent <PlayerInventoryManager>(); }
private void Awake() { healthSystem = GetComponent <HealthSystem>(); groundedItemDropController = GetComponent <GroundedItemDropController>(); playerInventoryManager = GameUtility.Player.GetComponent <PlayerInventoryManager>(); }
private void Awake() { ins = this; }
public void SetParent(PlayerInventoryManager _parent) { parent = _parent; value = new ModifiableInt(AttributeModified); }
private void Awake() { inv = GetComponent <PlayerInventoryManager>(); canv.enabled = false; }
private void Awake() { instance = this; animator = GetComponent <Animator>(); playerInventoryManager = GetComponent <PlayerInventoryManager>(); }
private void Awake() { playerInventory = FindObjectOfType <PlayerInventoryManager>(); }