예제 #1
0
파일: Pickable.cs 프로젝트: Aulbn/MRPG
 public void Open()
 {
     //Show inventory in UI
     Debug.Log("Open loot");
     InventoryDisplay.Open();
     InventoryDisplay.OpenLoot(this);
 }
예제 #2
0
 private void Awake()
 {
     inventoryDisplay = GetComponentInChildren <InventoryDisplay>(true);
     inventoryDisplay.OnSlotSelected = SetUpItemDescription;
     inventoryDisplay.OnSlotUsed     = OnItemUsed;
     inventoryDisplay.SubscribeToEquipmentSlotSelected(SetUpItemDescription);
 }
예제 #3
0
 void Start()
 {
     m_inventoryDisplay = GameObject.Find("Inventory").GetComponent <InventoryDisplay>();
     m_minimap          = GameObject.Find("HUD").GetComponent <Minimap>();
     RecipeHolder       = Resources.Load <CraftingRecipeHolder>("Crafting Recipes/Recipe Holder");
     m_backPack         = GetComponent <InventoryBackpack>();
 }
예제 #4
0
    public bool AddItem(Item _item, int _amount)
    {
        _inventoryDisplayScript = GameObject.Find("Inventory").GetComponent <InventoryDisplay>();

        // for (int i = 0; i < Container.Count; i++)
        // {
        //     if (Container[i].item == _item)
        //     {
        //         Container[i].AddAmount(_amount);
        //         _inventoryDisplayScript.UpdateDisplay();
        //         hasItem = true;
        //         break;
        //     }
        // }
        for (int i = 0; i < Container.Count; i++)
        {
            if (Container[i].item.name == "Empty")
            {
                Container.RemoveAt(i);
                Container.Insert(i, new InventorySlot(_item, _amount));
                _inventoryDisplayScript.UpdateDisplay();
                return(true);
            }
        }
        return(false);
    }
예제 #5
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
 }
 private void Start()
 {
     if (!m_manager.Creative)
     {
         m_display = GameObject.Find("Inventory").GetComponent <InventoryDisplay>();
     }
 }
예제 #7
0
파일: Pickable.cs 프로젝트: Aulbn/MRPG
 private void OnTriggerExit(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         Player.Instance.GetComponent <PlayerInteraction>().RemovePickable(this);
     }
     InventoryDisplay.CloseLoot();
 }
예제 #8
0
    //private void Start()
    //{
    //    Close();
    //}

    public void Open()
    {
        gameObject.SetActive(true);

        InventoryDisplay.SimpleOpen();
        menuPanel.gameObject.SetActive(false);
        menuButton.SetIsActive(true);
        pauseButton.SetIsActive(false);
    }
예제 #9
0
//This is where we find the components we need
    void Awake()
    {
        playersInv = FindObjectOfType(typeof(Inventory)) as Inventory;                          //finding the players inv.
        disp       = FindObjectOfType(typeof(InventoryDisplay)) as InventoryDisplay;
        if (playersInv == null)
        {
            Debug.LogWarning("No 'Inventory' found in game. The Item " + transform.name + " has been disabled for pickup (canGet = false).");
        }
        item = GetComponent <Item> ();
    }
예제 #10
0
public Transform itemHolderObject; //The object the unactive items are going to be parented to. In most cases this is going to be the Inventory object itself.



//Handle components and assign the itemHolderObject.
void Awake (){
	itemHolderObject = gameObject.transform;
	
	Contents = new List<Transform> ();
	playersInvDisplay = GetComponent<InventoryDisplay>();
	if (playersInvDisplay == null)
	{
		Debug.LogError("No Inventory Display script was found on " + transform.name + " but an Inventory script was.");
		Debug.LogError("Unless a Inventory Display script is added the Inventory won't show. Add it to the same gameobject as the Inventory for maximum performance");
	}
}
예제 #11
0
 public void InventoryClick(InventoryDisplay inventory)
 {
     if (this.inventory == null)
     {
         return;
     }
     if (inventory.AddItem(item, count) != 0)
     {
         NullifySelection();
     }
 }
예제 #12
0
    //Handle components and assign the itemHolderObject.
    void Awake()
    {
        itemHolderObject = gameObject.transform;

        playersInvDisplay = GetComponent <InventoryDisplay>();
        if (playersInvDisplay == null)
        {
            Debug.LogError("No Inventory Display script was found on " + transform.name + " but an Inventory script was.");
            Debug.LogError("Unless a Inventory Display script is added the Inventory won't show. Add it to the same gameobject as the Inventory for maximum performance");
        }
    }
예제 #13
0
 void Awake()
 {
     DontDestroyOnLoad(gameObject);
     if (inventoryDisplay == null)
     {
         inventoryDisplay = this;
     }
     else
     {
         DestroyObject(gameObject);
     }
 }
    void OnTriggerStay2D(Collider2D other)
    {
        rm        = recipeManager.GetComponent <RecipeManager>();
        inventory = inventoryManager.GetComponent <InventoryDisplay>();
        MouseController m        = other.GetComponent <MouseController>();
        string          heldItem = inventory.held();

        if (Input.GetKeyDown("f") && m != null && heldItem == toolName)
        {
            sound.Play();
            rm.itemCollected("Cabbage");
        }
    }
예제 #15
0
 public void ToggleInventoryMenu()
 {
     if (InventoryDisplay.Instance.gameObject.activeSelf)
     {
         InventoryDisplay.Open();
         menuPanel.gameObject.SetActive(true);
     }
     else
     {
         InventoryDisplay.Close();
         menuPanel.gameObject.SetActive(false);
     }
 }
예제 #16
0
    IEnumerator AllowAutoAddParty()
    {
        yield return(new WaitForSeconds(.31f));

        characterManager = FindObjectOfType <CharacterManager>();
        playerParty      = FindObjectOfType <PlayerParty>();
        data.playerParty = FindObjectOfType <PlayerParty>();
        inventoryDisplay = FindObjectOfType <InventoryDisplay>();
        inventoryItem    = FindObjectsOfType <InventoryItem>();
        currencyManager  = GetComponent <CurrencyManager>();
        currencyUI       = FindObjectOfType <CurrencyUI>();
        fogOfWar         = FindObjectOfType <FOW>();
        equipItems       = FindObjectsOfType <EquipItems>();
    }
예제 #17
0
    // Use this for initialization
    void Start()
    {
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        itemDisplays[selectedIndex].Select();
    }
예제 #18
0
//This will display the character sheet and handle the buttons.
    void DisplayCSheetWindow(int windowID)
    {
        if (canBeDragged == true)
        {
            GUI.DragWindow(new Rect(0, 0, 10000, 30));       //The window is dragable.
        }

        int index = 0;

        foreach (var a in ArmorSlot) //Loop through the ArmorSlot array.
        {
            if (a == null)
            {
                if (GUI.Button(buttonPositions[index], ArmorSlotName[index]))        //If we click this button (that has no item equipped):
                {
                    InventoryDisplay id = GetComponent <InventoryDisplay>();
                    if (id.itemBeingDragged != null)           //If we are dragging an item:
                    {
                        EquipItem(id.itemBeingDragged, index); //Equip the Item.
                        id.ClearDraggedItem();                 //Stop dragging the item.
                    }
                }
            }
            else
            {
                if (GUI.Button(buttonPositions[index], ArmorSlot[index].itemIcon))       //If we click this button (that has an item equipped):
                {
                    InventoryDisplay id2 = GetComponent <InventoryDisplay>();
                    if (id2.itemBeingDragged != null)                            //If we are dragging an item:
                    {
                        EquipItem(id2.itemBeingDragged, index);                  //Equip the Item.
                        id2.ClearDraggedItem();                                  //Stop dragging the item.
                    }
                    else if (playersinv.Contents.Length < playersinv.MaxContent) //If there is room in the inventory:
                    {
                        UnequipItem(ArmorSlot[index]);                           //Unequip the Item.
                        ArmorSlot[index] = null;                                 //Clear the slot.
                        id2.ClearDraggedItem();                                  //Stop dragging the Item.
                    }
                    else if (DebugMode)
                    {
                        Debug.Log("Could not unequip " + ArmorSlot[index].name + " since the inventory is full");
                    }
                }
            }
            index++;
        }
    }
예제 #19
0
    private void PickupWorldObject(WorldObject worldObject)
    {
        inventory.AddItem(worldObject);
        guiHandler.ViewBothGUIMessages(worldObject.objectTitle, "picked up.");
        //inventory.Display();
        InventoryDisplay inv = guiHandler.inventoryWindow.GetComponent <InventoryDisplay>();

        inv.PrimeItem(worldObject);
        if (inv.selectedItemDisplay.item == null)
        {
            inv.SelectObject(worldObject);
        }

        worldObject.gameObject.SetActive(false);
        justPickedUp = true;
    }
 void Start ()
 {
     if (hasAddedItems == false)
     {
         actor = FindObjectOfType<Actor>();
         targetTransform = GameObject.Find("InventoryDisplay").transform;
         inventoryItems = GameObject.FindGameObjectsWithTag("Item");
         inventoryDisplay = FindObjectOfType<InventoryDisplay>();
         StartCoroutine(BeginReturningIDS());
         hasAddedItems = true;
     }
     Actor[] actors = FindObjectsOfType<Actor>();
     for (int i = 1; i < actors.Length; i++)
     {
         Destroy(actors[i].gameObject);
     }
 }
예제 #21
0
        private void Start()
        {
            startScale = transform.localScale;

            var displays = FindObjectsOfType <InventoryDisplay>();

            for (int i = 0; i < displays.Length; i++)
            {
                if (displays[i].inventoryToDisplay == null)
                {
                    inventoryDisplay = displays[i];
                    break;
                }
            }

            helpText        = FindObjectOfType <HelpText>();
            cutSceneManager = FindObjectOfType <CutSceneManager>();
        }
예제 #22
0
 public void TakeAll(GeneralEnemyController Enemy)
 {
     if (Called == true)
     {
         if (Input.GetKeyDown(KeyCode.X))
         {
             Debug.Log("You Took Everything mate");
             Text          Texterer         = GetTheMonsterText();
             Text          PlayerMoney      = GetThePlayerText();
             PlayerSkiller PlayerReferenced = FindObjectOfType <PlayerSkiller>();
             PlayerReferenced.Wallet += Enemy.EnemyWallet;
             Enemy.EnemyWallet        = 0;
             Texterer.text            = "Money: " + Enemy.EnemyWallet.ToString();
             PlayerMoney.text         = "Money: " + PlayerReferenced.Wallet.ToString();
             InventoryDisplay Functioner = FindObjectOfType <InventoryDisplay>();
             Functioner.Cuarto(Enemy.EnemyList);
         }
     }
 }
예제 #23
0
    void Start()
    {
        if (Application.loadedLevel == 2)
        {
            //must remove this later, here till fix inventory load bugg
            actor            = FindObjectOfType <Actor>();
            targetTransform  = FindObjectOfType <InventoryDisplay>().gameObject.transform;
            inventoryDisplay = FindObjectOfType <InventoryDisplay>();
            StartCoroutine(BeginReturningIDS());
        }
        else if (Application.loadedLevel == 1)
        {
            //send info to reforge
        }

        Actor[] actors = FindObjectsOfType <Actor>();
        for (int i = 1; i < actors.Length; i++)
        {
            Destroy(actors[i].gameObject);
        }
    }
예제 #24
0
        // Use this for initialization
        private void Start()
        {
            m_Highlighter         = GetComponent <Highlighter>();
            m_FootStepController  = GetComponent <FootStepController>();
            m_InventoryDisplay    = GetComponent <InventoryDisplay>();
            m_Inventory           = GetComponent <Inventory>();
            m_CharacterController = GetComponent <CharacterController>();
            m_Camera = Camera.main;
            m_OriginalCameraPosition = m_Camera.transform.localPosition;
            m_FovKick.Setup(m_Camera);
            m_StepCycle = 0f;
            m_NextStep  = m_StepCycle / 2f;
            m_Jumping   = false;
            m_MouseLook.Init(transform, m_Camera.transform);

            targetPlayerHeight = m_standHeight = m_CharacterController.height;
            targetCameraHeight = m_cameraHeight = m_Camera.transform.localPosition.y;

            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;
        }
예제 #25
0
    /// <summary>
    /// Takes list and creates and fills display
    /// </summary>
    /// <param name="listItems">List items.</param>
    protected void ConfigurePrefab(List <InventoryItem> listItems)
    {
        InventoryDisplay _inventoryDisplayPrefab = null;

        if (typeof(T) == typeof(LernPlanInventoryDisplay))
        {
            //Fachkenntnisse werden entsprechend der Lernpunkte aufgelistet
            _inventoryDisplayPrefab = Instantiate(inventoryDisplayPrefab) as LernPlanInventoryDisplay;
        }
        else if (typeof(T) == typeof(SheetInventoryDisplay))
        {
            _inventoryDisplayPrefab = Instantiate(inventoryDisplayPrefab) as SheetInventoryDisplay;
        }
        else if (typeof(T) == typeof(BerufInventoryDisplay))
        {
            _inventoryDisplayPrefab = Instantiate(inventoryDisplayPrefab) as BerufInventoryDisplay;
        }

        _inventoryDisplayPrefab.name = panelName;
        _inventoryDisplayPrefab.transform.SetParent(displayParent, false);
        _inventoryDisplayPrefab.FillItemDisplay(listItems);
    }
예제 #26
0
    public void Display()
    {
        InventoryDisplay display = (InventoryDisplay)Instantiate(inventoryDisplayPrefab);

        display.Prime(creatureInventory);
    }
예제 #27
0
	void Awake()
	{
		invDisp = GetComponentInChildren<InventoryDisplay> ();
		if (invDisp == null)
			Debug.LogError("No inventory component attached to child object");
	}
예제 #28
0
 public void Open()
 {
     InventoryInstance = Instantiate(inventoryDisplayPrefab);
     InventoryInstance.Prime(Items);
 }
 private void Construct(InventoryDisplay inventoryDisplay)
 {
     InventoryDisplayHolder = inventoryDisplay.InventoryDisplayHolder;
     inventoryDisplaySlots  = inventoryDisplay.InventoryDisplayHolder.GetComponentsInChildren <Image>();
     hotBarDisplayHolders   = inventoryDisplay.HotbarDisplaySlots;
 }
예제 #30
0
 void Start()
 {
     //Grab the player's inventory and the tooltip component.
     inv     = GameObject.Find("InventoryDisplay").GetComponent <InventoryDisplay>();
     tooltip = inv.GetComponent <Tooltip>();
 }
예제 #31
0
 public void Close()
 {
     gameObject.SetActive(false);
     InventoryDisplay.Close();
     UIManager.Instance.SetPause(false);
 }
예제 #32
0
 // Use this for initialization
 void Start()
 {
     //Get the front end representation
     inv = GameObject.Find("InventoryDisplay").GetComponent <InventoryDisplay>();
 }
예제 #33
0
		private void onHideInventory() {
			_inventoryRef.onItemSelected -= onItemSelected;
			_inventoryRef.onHideInventory -= onHideInventory;
			Destroy(_inventoryRef.gameObject);
			_inventoryRef = null;
		}
        public void Handle(Player player, Location location)
        {
            ConsoleKeyInfo input = Console.ReadKey();

            switch (input.Key)
            {
            case ConsoleKey.W:
                Console.WriteLine("\tMoving forward");
                if (!player.MoveUp(location))
                {
                    Console.WriteLine("End of the map!");
                }

                break;

            case ConsoleKey.A:
                Console.WriteLine("\tMoving left");
                if (!player.MoveLeft(location))
                {
                    Console.WriteLine("End of the map!");
                }

                break;

            case ConsoleKey.S:
                Console.WriteLine("\tMoving backward");
                if (!player.MoveDown(location))
                {
                    Console.WriteLine("End of the map!");
                }

                break;

            case ConsoleKey.D:
                Console.WriteLine("\tMoving right");
                if (!player.MoveRight(location))
                {
                    Console.WriteLine("End of the map!");
                }

                break;

            case ConsoleKey.E:
                Console.WriteLine("\tUsing item");
                if (player.UseCurrentItem())
                {
                    Console.WriteLine("You can't use item!");
                }

                break;

            case ConsoleKey.M:
                Console.WriteLine("\tMap");
                Console.WriteLine("X: " + player.Coords.Value.X + " | Y: " + player.Coords.Value.Y);
                break;

            case ConsoleKey.Spacebar:
                Console.WriteLine("\tFire");
                break;

            case ConsoleKey.Tab:
                Console.WriteLine("\tInventory");
                InventoryDisplay.DisplayInventory(player);
                break;

            case ConsoleKey.H:
                Console.Clear();
                Program.ShowHelp();
                break;

            default:
                Console.WriteLine("\tInvalid operation!");
                break;
            }
        }