예제 #1
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        ItemWorld itemWorld = collider.GetComponent <ItemWorld>();

        if (itemWorld != null)
        {
            //touching item

            //Checking if Inventory is full
            int InventorySpace = 1;
            foreach (Item item in inventory.GetItemList())
            {
                InventorySpace++;
            }
            //Debug.Log(InventorySpace + " unique Items in Inventory");

            if (InventorySpace > 40)
            {
                Debug.Log("Inventory Full");
                return;
            }

            inventory.AddItem(itemWorld.GetItem());
            itemWorld.DestroySelf();
        }
    }
예제 #2
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        ItemWorld itemWorld = collider.GetComponent <ItemWorld>();

        if (itemWorld != null)
        {
            itemWorld.DestroySelf();
        }
    }
예제 #3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Debug.Log("jestem w trigerze");
        ItemWorld itemWorld = collision.GetComponent <ItemWorld>();

        //Touching Item

        inventory.AddItem(itemWorld.GetItem());
        itemWorld.DestroySelf();
    }
예제 #4
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        ItemWorld itemWorld = collision.GetComponent <ItemWorld>();

        if (itemWorld != null)
        {
            Inventory.AddItem(itemWorld.item);
            itemWorld.DestroySelf();
        }
    }
예제 #5
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        // Pick up an item
        ItemWorld itemWorld = collider.GetComponent <ItemWorld>();

        if (itemWorld != null)
        {
            // Touching Item
            Item item = itemWorld.GetItem();

            // If its a red flower and player is holding an oxygen processor, process it for oxygen
            if (item.itemType == Item.ItemType.RedOxygenFlower && keyItem == KeyItem.OxygenProcessor)
            {
                GainOxygen(20);
                if (quest.number == 2)
                {
                    quest.goal.ItemCollected();
                    if (quest.goal.currentAmount >= quest.goal.requiredAmount)
                    {
                        quest.Complete();
                    }
                }
                itemWorld.DestroySelf();
            }
            // If the item is not a red flower, pick it up and add it to the inventory
            else if (item.itemType != Item.ItemType.RedOxygenFlower)
            {
                inventory.AddItem(item);
                lastItemPickedUp = item.itemType;
                itemWorld.DestroySelf();
            }
            /* return;*/
        }

/*        Ox ox = collider.GetComponent<Ox>();
 *      if (ox != null)
 *      {
 *          if (ox.isAngry)
 *          {
 *              TakeDamage(20);
 *          }
 *      }*/
    }
예제 #6
0
    private void OnTriggerEnter(Collider Hit)
    {
        ItemWorld itemWorld = Hit.GetComponent <ItemWorld>();

        if (itemWorld != null)
        {
            invertory.AddItem(itemWorld.GetItem());
            itemWorld.DestroySelf();
        }
    }
예제 #7
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        ItemWorld itemWorld = collider.GetComponent <ItemWorld>();

        if (itemWorld != null)
        {
            Debug.Log("Colliding");
            inventory.AddItem(itemWorld.GetItem());
            itemWorld.DestroySelf();
        }
    }
    private void OnTriggerEnter2D(Collider2D collider)
    {
        ItemWorld itemWorld = collider.GetComponent <ItemWorld>();

        if (itemWorld != null)
        {
            //Touching Item
            inventory.AddItem(itemWorld.GetItem());
            itemWorld.DestroySelf();
        }
    }
예제 #9
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        ItemWorld itemWorld = collider.GetComponent <ItemWorld>();

        if (itemWorld != null)
        {
            inventory.AddItem(itemWorld.GetItem());
            itemWorld.DestroySelf();
            JumlahBatu.Jumlah += 1;
        }
    }
예제 #10
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.GetComponent <ItemWorld>() != null)
        {
            ItemWorld itemWorld = collider.GetComponent <ItemWorld>();

            if (numOfOwnItem < inventory.GetMaxCapacity())
            {
                if (itemWorld != null)
                {
                    //Touching item
                    if (inventory.itemInList(itemWorld.GetItem()))
                    {
                        if (!itemWorld.GetItem().IsStackable())
                        {
                            numOfOwnItem += 1;
                        }
                    }
                    else
                    {
                        numOfOwnItem += 1;
                    }
                    inventory.AddItem(itemWorld.GetItem());
                    itemWorld.DestroySelf();
                }
            }
            else if (numOfOwnItem == inventory.GetMaxCapacity())
            {
                if (inventory.itemInList(itemWorld.GetItem()))
                {
                    if (itemWorld.GetItem().IsStackable())
                    {
                        inventory.AddItem(itemWorld.GetItem());
                        itemWorld.DestroySelf();
                    }
                }
            }
        }
    }
    private void OnTriggerEnter(Collider collision)
    {
        ItemWorld itemWorld = collision.GetComponent <ItemWorld>();

        if (itemWorld != null)
        {
            //If the colliding object contains Items world script
            if (itemWorld.GetItem().itemType == Item.ItemType.Torch)
            {
                resumeTimer = false;
            }
            inventory.AddItem(itemWorld.GetItem());
            itemWorld.DestroySelf();
        }
    }
예제 #12
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.transform.tag == "OutOfZone" && enemieSpotCollide == true)
        {
            enemieSpotCollide = false;
            Enemie            = null;
        }
        if (collision.transform.tag == "EnemieSpot" && enemieSpotCollide == false)
        {
            enemieSpotCollide = true;
            enemieSpotName    = collision.gameObject.name;
        }

        ItemWorld itemWorld = collision.GetComponent <ItemWorld>();

        if (itemWorld != null)
        {
            //Tocando o item
            inventory.AddItem(itemWorld.GetItem());
            itemWorld.DestroySelf();
        }
        if (collision.gameObject.tag == "Coin")
        {
            inventory.AddItem(new Item {
                itemType = Item.ItemType.Coin, amount = collision.gameObject.GetComponent <AmountCoinsDrop>().amountCoins
            });
            Destroy(collision.gameObject);
        }
        if (canUseMagic == true && collision.gameObject.tag == "NpcVelho")
        {
            Destroy(collision.gameObject.GetComponent <Conversa>());
        }

        if (collision.gameObject.tag == "BossFireBallCircle")
        {
            ActualLife = ActualLife - 30;
            StartCoroutine("Invencible");
        }
        if (collision.gameObject.tag == "BossFireBall")
        {
            ActualLife = ActualLife - 10;
            StartCoroutine("Invencible");
        }
    }
예제 #13
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.tag == "Save")
        {
            playerSaveCanvas.gameObject.SetActive(true);
            playerSaveCanvas.transform.GetChild(0).gameObject.SetActive(false);
            playerSaveCanvas.transform.GetChild(1).gameObject.SetActive(true);
        }

        if (collision.gameObject.tag == "Fuel")
        {
            blackboard.iFuelCount = blackboard.iFuelCount + go_FuelPrefab.GetComponent <Fuel>().iFuelDropAmmount;
            Destroy(collision.gameObject);
        }

        ItemWorld itemWorld = collision.GetComponent <ItemWorld>();

        if (itemWorld != null)
        {
            inventory.AddItem(itemWorld.GetItem());
            itemWorld.DestroySelf();
        }

        if (collision.gameObject.tag == "Ladder")
        {
            ClimbLadder();
        }

        /// <summary>
        /// Jack Created
        /// </summary>

        // If the player collides with snow and is pressing A or D
        if (collision.gameObject.tag == "Snow" && (Input.GetKey(KeyCode.D) || (Input.GetKey(KeyCode.A))))
        {
            // Sound manager, play snow audio
            soundManager.PlaySnowAudio();
        }

        /// <summary>
        /// End of Jacks work
        /// </summary>
    }