예제 #1
0
 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.");
     }
 }
예제 #2
0
    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);
        }
    }
예제 #3
0
    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);
        }
    }
예제 #4
0
    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);
        }
    }