private void SetResource() { if (userInterface != null) { userInterface.AddResource(resourceIndex, amount, GetComponent <SpriteRenderer>().sprite); //userInterface.AddResource(resourceIndex, amount, null); } else { Debug.LogWarning("User Interface is not in the scene, so the resource cannot be displayed and put in the inventory."); } }
private void OnTriggerEnter2D(Collider2D otherCollider) { // is the other object a player? if (otherCollider.CompareTag("Player") || otherCollider.CompareTag("Player2")) { if (userInterface != null) { userInterface.AddResource(resourceType, amount, GetComponent <SpriteRenderer>().sprite); } Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D otherCollider) { // is the other object a player? if (otherCollider.CompareTag("Player") || otherCollider.CompareTag("Player2")) { if (userInterface != null) { userInterface.AddResource(resourceIndex, amount, GetComponent <SpriteRenderer>().sprite); } else { Debug.LogWarning(_("User Interface is not in the scene, so the resource cannot be displayed and put in the inventory.")); } Destroy(gameObject); } }
private void OnTriggerEnter2D(Collider2D otherCollider) { // is the other object a player? if (otherCollider.CompareTag("Player") || otherCollider.CompareTag("Player2")) { if (userInterface != null) { userInterface.AddResource(resourceIndex, amount, GetComponent <SpriteRenderer>().sprite); } else { Debug.LogWarning("User Interface is not in the scene, so the resource cannot be displayed and put in the inventory."); } //so here the bolt finds this script and will activate this method to reduce bolt count FindObjectOfType <BoltCount>().CollectBolt(); Destroy(gameObject); } }