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();
        }
    }
Exemple #2
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();
        }
    }
Exemple #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();
    }
Exemple #4
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        ItemWorld itemWorld = collider.GetComponent <ItemWorld>();

        if (itemWorld != null)
        {
            inventory.AddItem(itemWorld.GetItem());
            itemWorld.DestroySelf();
        }
    }
    private void OnTriggerEnter(Collider Hit)
    {
        ItemWorld itemWorld = Hit.GetComponent <ItemWorld>();

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

        if (itemWorld != null)
        {
            Debug.Log("Colliding");
            inventory.AddItem(itemWorld.GetItem());
            button1.SetActive(true);
            button2.SetActive(true);
            itemWorld.DestroySelf();
        }
    }
Exemple #7
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        ItemWorld itemWorld = null;

        if (collision.transform.parent != null)
        {
            itemWorld = collision.transform.parent.GetComponent <ItemWorld>();
        }

        if (collision.gameObject.CompareTag("Collectable") && itemWorld != null && collision.transform.parent.gameObject.activeSelf)
        {
            if (inventory.AddItem(itemWorld.GetItem()))
            {
                collision.transform.parent.gameObject.SetActive(false);
                Destroy(collision.transform.parent.gameObject);
            }
        }
    }
Exemple #8
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");
        }
    }
Exemple #9
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);
 *          }
 *      }*/
    }
Exemple #10
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>
    }
Exemple #11
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();
                    }
                }
            }
        }
    }
Exemple #12
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        ItemWorld itemWorld = other.GetComponent <ItemWorld>(); //gets item world compoenent

        if (itemWorld)                                          //if object has itme world
        {
            SoundManager.PlaySound("pickup");                   //plays pick up sound
            inventory.AddItem(itemWorld.GetItem());             //adds itme to UI inven
            itemWorld.DestorySelf();                            //destorys self
            Debug.Log("collected");                             // debug for checking
        }

        // checks item for sprite name, if matches adds 1 to inventory
        if (other.gameObject.GetComponent <SpriteRenderer>().sprite.name == "HealthSprite")
        {
            PlayerHealth.Healthup++;
            Debug.Log("Healthup");
        }

        if (other.gameObject.GetComponent <SpriteRenderer>().sprite.name == "DmgSprite")
        {
            Dmgup++;
            Debug.Log("Dmgup");
        }

        if (other.gameObject.GetComponent <SpriteRenderer>().sprite.name == "SpeedSprite")
        {
            Speedup++;
            Debug.Log("speedup");
        }

        if (other.gameObject.GetComponent <SpriteRenderer>().sprite.name == "ChainSprite")
        {
            chainup++;
            Debug.Log("chainup");
        }

        if (other.gameObject.GetComponent <SpriteRenderer>().sprite.name == "SpreadSprite")
        {
            spreadup++;
            Debug.Log("spreadup");
        }

        if (other.gameObject.GetComponent <SpriteRenderer>().sprite.name == "LifeSprite")
        {
            lifeup++;
            Debug.Log("lifeup");
        }

        if (other.gameObject.GetComponent <SpriteRenderer>().sprite.name == "VerlocitySprite")
        {
            verlocityup++;
            Debug.Log("verlocityup");
        }

        if (other.gameObject.GetComponent <SpriteRenderer>().sprite.name == "LifeTapSprite")
        {
            lifetapup++;
            Debug.Log("lifetapup");
        }
    }