Ejemplo n.º 1
0
    public void addToInvo(GameObject obj)
    {
        if (inventory.checkIfWeCanAdd(obj.GetComponent <ItemPickup>().item))
        {
            objPoolManager.ObjectPoolAddition(obj);
            ItemPickup ip = obj.GetComponent <ItemPickup>();
            tempItem      = ip.item;
            tempItemCount = ip.count;
            inventory.Add(tempItem, tempItemCount);
        }
        else
        {
            objPoolManager.DropTable(obj, transform.position);
        }

        /*  tempItemGameobject = obj;
         *
         * Debug.Log(tempItemGameobject.name);
         * if (tempItemCount <= 0)
         * {
         *    Debug.LogError(tempItemGameobject.name + " item pickup count is 0 or less then");
         * }
         *
         *
         *    objPoolManager.ReturnFromPool(obj);*/
    }
Ejemplo n.º 2
0
    public void Start()
    {
        inventory       = new InventorySystem();
        equipmentSystem = new EquipmentManager();
        equipmentSystem.Start();
        objPoolManager = GameManager.instance.objPoolManager;

        //Test Items
        for (int i = 0; i < testItems.Length; i++)
        {
            inventory.Add(testItems[i].GetComponent <ItemPickup>().item, 17);
        }

        inventory.TestInventory();

        Invoke("setBounds", 0.1f);

        currentPath = null;

        localScale = healthbar.localScale;

        if (objPoolManager.itemmanager.tester == null)
        {
            objPoolManager.itemmanager.initializeEnemies();
        }
        else
        {
            objPoolManager.itemmanager.loadEnemies();
        }
    }
Ejemplo n.º 3
0
 public void FindFragment()
 {
     gameManager.fragmentsFound++;
     fragment = new Item("Fragment for Final Door", "Key Fragment", fragmentIcon);
     inventory.Add(fragment);
     dialogueManager.TriggerDialogue("You found a key fragment!");
     Destroy(gameObject);
 }
Ejemplo n.º 4
0
 public void Update()
 {
     if (triggerObject != null && Vector2.Distance(transform.position, triggerObject.transform.position) <= 50f)
     {
         //Camera.main.GetComponent<CameraShake>().ShakeCamera();
         inventorySystem.Add(GetComponent <Item>().itemData);
     }
 }
Ejemplo n.º 5
0
    //pick up items

    //incomplete - need to add to inventory etc/ also need pickup item button and current node check function at the end of control function to see if there is something we can pick up

    public void pickUp()
    {
        if (currentNode.stack.Count > 0)
        {
            tempItemGameobject = currentNode.stack.Peek().gameObject;

            if (tempItemGameobject == null)
            {
                Debug.LogError("Player is picking up an empty gameobject somehow");
            }

            if (!inventory.checkIfWeCanAdd(tempItemGameobject.GetComponent <ItemPickup>().item))
            {
                return;
            }

            //check if we have enough inventory space
            //if true do this

            //check to see if we either consume it(dew), or add it to vial in inventory if health full? or add to invo

            //remove it from stack
            currentNode.stack.Pop();

            ////decrement nodes index for sprite rendering order
            //currentNode.index--;

            //check if there are still any items left on my node

            displayPickUpButton();

            //Add to inventoy Here
            objPoolManager.ObjectPoolAddition(tempItemGameobject);

            if (tempItemGameobject.GetComponent <ItemPickup>() == null)
            {
                Debug.Log(tempItemGameobject.name + "Error, Item Pickup Is not implimented onto this object");
            }
            if (tempItemGameobject.GetComponent <ItemPickup>().item == null)
            {
                Debug.Log(tempItemGameobject.name + "Error, The Item in Item Pickup component is null on this prefab object");
            }

            tempItem      = tempItemGameobject.GetComponent <ItemPickup>().item;
            tempItemCount = tempItemGameobject.GetComponent <ItemPickup>().count;
            if (tempItemCount <= 0)
            {
                Debug.LogError(tempItemGameobject.name + " item pickup count is 0 or less then");
            }

            inventory.Add(tempItem, tempItemCount);

            //pass control to other entities if we picked something up?
            Control();
        }
    }
Ejemplo n.º 6
0
 void OnMouseOver()
 {
     if (Input.GetButtonDown("Fire1") && Vector2.Distance(transform.position, GameObject.FindGameObjectWithTag("Player").transform.position) < 5)
     {
         Debug.Log("Clicked");
         inventory.Add(codePeice);
         gameManager.codePeicesFound++;
         Destroy(gameObject);
     }
 }
Ejemplo n.º 7
0
 private void Update()
 {
     if (fragmentsFound == 3)
     {
         finalKey = new Item("Opens Final Door", "Final Key", icon);
         inventory.Remove(KeyFragment.fragment);
         inventory.Add(finalKey);
         dialogueManager.TriggerDialogue("The fragments formed a key!");
         fragmentsFound = 0;
     }
     if (codePeicesFound == 2)
     {
         finalCode = new Item("Has the code!", "Final Code", codeIcon);
         inventory.Remove(CodePaper.codePeice);
         inventory.Add(finalCode);
         dialogueManager.TriggerDialogue("The code!");
         codePeicesFound = 0;
     }
 }
Ejemplo n.º 8
0
    void OnMouseOver()
    {
        if (Input.GetButtonDown("Fire1") && Vector2.Distance(transform.position, GameObject.FindGameObjectWithTag("Player").transform.position) < 1f)
        {
            if (!inventory.canIncrease)
            {
                Debug.Log("Inventory is full!");
                dialogueManager.TriggerDialogue("Your inventory is full!");
            }

            else
            {
                inventory.Add(toolItem);
                Debug.Log("I picked up a tool!");
                dialogueManager.TriggerDialogue("You picked up a tool!");
                Destroy(gameObject);
            }
        }
    }
Ejemplo n.º 9
0
 public void AddItem(IItem item)
 {
     int i = inventorySystem.Add(item);
 }
Ejemplo n.º 10
0
 public void AddCollectable(Collectable c)
 {
     _inventory.Add(c);
 }