Esempio n. 1
0
    private void Update()
    {
        if (Input.GetButtonDown("Interact") && currentObject)
        {
            //Ist dies ein Inventory Objekt?
            if (currentObjectScript.inventory)
            {
                inventory.AddItem(currentObject);
            }
        }

        if (Input.GetButtonDown("Interact") && _endGameObject)
        {
            //Ist dies ein Inventory Objekt?
            if (currentObjectScript.inventory && inventory.InventoryFull() == true)
            {
                inventory.AddItem(_endGameObject);
                GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameStateManager>().YouWin();
            }
        }

        //Benutze die gesammelten Bruchstücke
        if (Input.GetButtonDown("Use") && currentObject)
        {
            Debug.Log("Q was pressed!");
            //Inventar prüfen (ShuttlePiece)
            GameObject ShuttlePiece = inventory.FindItemByType("Nektar");
            if (ShuttlePiece != null)
            {
                //Bruchstücke verwenden - Shuttle Reparieren
                //Von Inventar entfernen
                if (currentObjectScript.inventory)
                {
                    inventory.RemoveItem(inventory.FindItemByType("Nektar"));
                }
            }
            if (ShuttlePiece = null)
            {
                Debug.Log("Can't find a ShuttlePiece!");
            }
        }
    }