deactivateTooltip() public method

public deactivateTooltip ( ) : void
return void
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                characterSystemInventory.openInventory();
                LockCameraAndShowMouse();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
                UnlockCameraAndHideMouse();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (!inventory.activeSelf)
            {
                mainInventory.openInventory();
                LockCameraAndShowMouse();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                mainInventory.closeInventory();
                UnlockCameraAndHideMouse();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
        {
            if (!craftSystem.activeSelf)
            {
                craftSystemInventory.openInventory();
                LockCameraAndShowMouse();
            }
            else
            {
                if (cS != null)
                {
                    cS.backToInventory();
                }
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                craftSystemInventory.closeInventory();
                UnlockCameraAndHideMouse();
            }
        }
    }
    void Update()
    {
        float distance = Vector3.Distance(gameObject.transform.position, player.transform.position);

        if (showTimer)
        {
            if (timerImage != null)
            {
                timer.SetActive(true);
                float fillAmount = (Time.time - startTimer) / timeToOpenStorage;
                timerImage.fillAmount = fillAmount;
            }
        }

        if (distance > distanceToOpenStorage && showStorage)
        {
            showStorage = false;
            if (inventory.activeSelf)
            {
                storageItems.Clear();
                setListofStorage();
                inventory.SetActive(false);
                inv.deleteAllItems();
            }
            tooltip.deactivateTooltip();
            timerImage.fillAmount = 0;
            timer.SetActive(false);
            showTimer = false;
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                characterSystemInventory.openInventory();
                //statPanel.GetComponent<StatUpdate>().statUpdate();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (!inventory.activeSelf)
            {
                mainInventory.openInventory();
                Gooooold.text = PlayerData.getMoney().ToString();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                mainInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
        {
            if (!craftSystem.activeSelf)
            {
                craftSystemInventory.openInventory();
            }
            else
            {
                if (cS != null)
                {
                    cS.backToInventory();
                }
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                craftSystemInventory.closeInventory();
            }
        }
    }
    void Update()
    {
        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                characterSystemInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
            }
        }

        if (Input.GetButtonDown("Inventory"))
        {
            if (!inventory.activeSelf)
            {
                mainInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                mainInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
        {
            if (!craftSystem.activeSelf)
            {
                craftSystemInventory.openInventory();
            }
            else
            {
                if (cS != null)
                {
                    cS.backToInventory();
                }
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                craftSystemInventory.closeInventory();
            }
        }
    }
Beispiel #5
0
 public void OnInventory()
 {
     if (!inventory.activeSelf)
     {
         mainInventory.openInventory();
     }
     else
     {
         if (toolTip != null)
         {
             toolTip.deactivateTooltip();
         }
         mainInventory.closeInventory();
     }
 }
Beispiel #6
0
        // Update is called once per frame
        void Update()
        {
            if (blocked)
            {
                return;
            }

            if (characterSystem != null && Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
            {
                if (!characterSystem.activeSelf)
                {
                    characterSystemInventory.OpenInventory();
                }
                else
                {
                    if (toolTip != null)
                    {
                        toolTip.deactivateTooltip();
                    }
                    characterSystemInventory.CloseInventory();
                }
            }

            if (inventory != null && Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
            {
                characterSwitch.GetCurrentCharacter().GetComponentInChildren <StorageInventory>().ToggleStorage();
            }

            if (craftSystem != null && Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
            {
                if (!craftSystem.activeSelf)
                {
                    craftSystemInventory.OpenInventory();
                }
                else
                {
                    if (cS != null)
                    {
                        cS.backToInventory();
                    }
                    if (toolTip != null)
                    {
                        toolTip.deactivateTooltip();
                    }
                    craftSystemInventory.CloseInventory();
                }
            }
        }
Beispiel #7
0
 public void OnPointerExit(PointerEventData data)                //if we go out of the slot with the item
 {
     if (tooltip != null)
     {
         tooltip.deactivateTooltip();            //the tooltip getting deactivated
     }
 }
Beispiel #8
0
 public void sellItem()
 {
     if (Input.GetKey(KeyCode.LeftShift) && charMotor.isInShop)
     {
         playerInv.goldCoins += GetComponent <ItemOnObject>().itemPrice;
         tooltip.deactivateTooltip();
         Destroy(gameObject);
     }
 }
Beispiel #9
0
    void Update()
    {
        float distance = Vector3.Distance(this.gameObject.transform.position, player.transform.position);

        if (showTimer)
        {
            if (timerImage != null)
            {
                timer.SetActive(true);
                float fillAmount = (Time.time - startTimer) / timeToOpenStorage;
                timerImage.fillAmount = fillAmount;
            }
        }

        if (distance <= distanceToOpenStorage && Input.GetKeyDown(inputManagerDatabase.StorageKeyCode))
        {
            showStorage = !showStorage;
            StartCoroutine(OpenInventoryWithTimer());
        }

        if (distance > distanceToOpenStorage && showStorage)
        {
            if (isChest)
            {
                gameObject.GetComponent <Animator>().SetTrigger("Activate");
            }

            showStorage = false;
            if (inventory.activeSelf)
            {
                storageItems.Clear();
                setListofStorage();
                inventory.SetActive(false);
                inv.deleteAllItems();
            }
            tooltip.deactivateTooltip();
            timerImage.fillAmount = 0;
            timer.SetActive(false);
            showTimer = false;
        }
    }
Beispiel #10
0
    void LateUpdate()
    {
        //_ShowAndroidToastMessage("In inventory");

        float distance = 0;

        if (showTimer)
        {
            if (timerImage != null)
            {
                timer.SetActive(true);
                float fillAmount = (Time.time - startTimer) / timeToOpenStorage;
                timerImage.fillAmount = fillAmount;
            }
        }

        if (openInv)
        {
            showStorage = !showStorage;
            StartCoroutine(OpenInventoryWithTimer());
            openInv = false;
        }

        if (distance > distanceToOpenStorage && showStorage)
        {
            showStorage = false;
            if (inventory.activeSelf)
            {
                storageItems.Clear();
                setListofStorage();
                inventory.SetActive(false);
                inv.deleteAllItems();
            }
            tooltip.deactivateTooltip();
            timerImage.fillAmount = 0;
            timer.SetActive(false);
            showTimer = false;
        }
    }
Beispiel #11
0
 public void dropItem_re(Int32 itemIndex)
 {
     if (itemInventory == null)
     {
         itemInventory = this.transform.GetComponent <PlayerInventory>().inventory.GetComponent <Inventory>();
     }
     if (itemInventory != null)
     {
         itemInventory.deleteItemByIndex(itemIndex);
         itemInventory.updateItemList();
         itemInventory.stackableSettings();
         tooltip.deactivateTooltip();
     }
 }
Beispiel #12
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
     {
         if (!inventory.activeSelf)
         {
             this.stateHolder.setInventary();
             mainInventory.openInventory();
         }
         else
         {
             if (toolTip != null)
             {
                 toolTip.deactivateTooltip();
             }
             this.stateHolder.setPlaying();
             mainInventory.closeInventory();
         }
     }
 }
Beispiel #13
0
    public void OnPointerDown(PointerEventData data)
    {
        if (this.gameObject.transform.parent.parent.parent.GetComponent <EquipmentSystem>() == null)
        {
            bool      gearable  = false;
            Inventory inventory = transform.parent.parent.parent.GetComponent <Inventory>();

            if (eS != null)
            {
                itemTypeOfSlot = eS.itemTypeOfSlots;
            }

            if (data.button == PointerEventData.InputButton.Left && DoubleClick() && item.itemType == ItemType.Consumable)     // if we doubleClick with the mouse's left button
            {
                //item from craft system to inventory
                if (transform.parent.GetComponent <CraftResultSlot>() != null)
                {
                    bool check = inv.GetComponent <Inventory>().checkIfItemAllreadyExist(item.itemID, item.itemValue);

                    if (!check)
                    {
                        for (int j = 0; j < inv.transform.GetChild(1).transform.childCount; j++)
                        {
                            if (inv.transform.GetChild(1).transform.GetChild(j).childCount != 0)
                            {
                                //if the item we're crafting has a slot filled in the main inventory and there are some places
                                if (item.itemID.Equals(inv.transform.GetChild(1).transform.GetChild(j).GetChild(0).GetComponent <ItemOnObject>().item.itemID) && inv.transform.GetChild(1).transform.GetChild(j).GetChild(0).GetComponent <ItemOnObject>().item.itemValue != inv.transform.GetChild(1).transform.GetChild(j).GetChild(0).GetComponent <ItemOnObject>().item.maxStack)
                                {
                                    //filling the remaining places before adding the rest through the normal add
                                    if (inv.transform.GetChild(1).transform.GetChild(j).GetChild(0).GetComponent <ItemOnObject>().item.itemValue + item.itemValue > inv.transform.GetChild(1).transform.GetChild(j).GetChild(0).GetComponent <ItemOnObject>().item.maxStack)
                                    {
                                        item.itemValue -= (inv.transform.GetChild(1).transform.GetChild(j).GetChild(0).GetComponent <ItemOnObject>().item.maxStack - inv.transform.GetChild(1).transform.GetChild(j).GetChild(0).GetComponent <ItemOnObject>().item.itemValue);
                                        inv.transform.GetChild(1).transform.GetChild(j).GetChild(0).GetComponent <ItemOnObject>().item.itemValue = inv.transform.GetChild(1).transform.GetChild(j).GetChild(0).GetComponent <ItemOnObject>().item.maxStack;
                                    }
                                }
                            }
                        }
                        //normal add
                        numberOfItems = item.itemValue / item.maxStack;
                        for (int i = 0; i < numberOfItems; i++)
                        {
                            inv.GetComponent <Inventory>().addItemToInventory(item.itemID, item.maxStack);
                            inv.GetComponent <Inventory>().stackableSettings();
                        }
                        if (item.itemValue % item.maxStack != 0)
                        {
                            inv.GetComponent <Inventory>().addItemToInventory(item.itemID, item.itemValue % item.maxStack);
                            inv.GetComponent <Inventory>().stackableSettings();
                        }
                    }
                    CraftSystem cS = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>().craftSystem.GetComponent <CraftSystem>();
                    cS.deleteItems(item);
                    CraftResultSlot result = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>().craftSystem.transform.GetChild(3).GetComponent <CraftResultSlot>();
                    tooltip.deactivateTooltip();
                    gearable = true;
                    inv.GetComponent <Inventory>().updateItemList();
                }
                else
                {
                    bool stop = false;
                    if (eS != null)
                    {
                        for (int i = 0; i < eS.slotsInTotal; i++)
                        {
                            if (itemTypeOfSlot[i].Equals(item.itemType))
                            {
                                if (eS.transform.GetChild(1).GetChild(i).childCount == 0)
                                {
                                    stop = true;
                                    if (eS.transform.GetChild(1).GetChild(i).parent.parent.GetComponent <EquipmentSystem>() != null && this.gameObject.transform.parent.parent.parent.GetComponent <EquipmentSystem>() != null)
                                    {
                                    }
                                    else
                                    {
                                        inventory.EquiptItem(item);
                                    }

                                    this.gameObject.transform.SetParent(eS.transform.GetChild(1).GetChild(i));
                                    this.gameObject.GetComponent <RectTransform>().localPosition = Vector3.zero;
                                    eS.gameObject.GetComponent <Inventory>().updateItemList();
                                    inventory.updateItemList();
                                    gearable = true;
                                    if (duplication != null)
                                    {
                                        Destroy(duplication.gameObject);
                                    }
                                    break;
                                }
                            }
                        }

                        if (!stop)
                        {
                            for (int i = 0; i < eS.slotsInTotal; i++)
                            {
                                if (itemTypeOfSlot[i].Equals(item.itemType))
                                {
                                    if (eS.transform.GetChild(1).GetChild(i).childCount != 0)
                                    {
                                        GameObject otherItemFromCharacterSystem = eS.transform.GetChild(1).GetChild(i).GetChild(0).gameObject;
                                        Item       otherSlotItem = otherItemFromCharacterSystem.GetComponent <ItemOnObject>().item;
                                        if (item.itemType == ItemType.UFPS_Weapon)
                                        {
                                            inventory.UnEquipItem1(otherItemFromCharacterSystem.GetComponent <ItemOnObject>().item);
                                            inventory.EquiptItem(item);
                                        }
                                        else
                                        {
                                            inventory.EquiptItem(item);
                                            if (item.itemType != ItemType.Backpack)
                                            {
                                                inventory.UnEquipItem1(otherItemFromCharacterSystem.GetComponent <ItemOnObject>().item);
                                            }
                                        }
                                        if (this == null)
                                        {
                                            GameObject dropItem = (GameObject)Instantiate(otherSlotItem.itemModel);
                                            dropItem.AddComponent <PickUpItem>();
                                            dropItem.GetComponent <PickUpItem>().item = otherSlotItem;
                                            dropItem.transform.localPosition          = GameObject.FindGameObjectWithTag("Player").transform.localPosition;
                                            inventory.OnUpdateItemList();
                                        }
                                        else
                                        {
                                            otherItemFromCharacterSystem.transform.SetParent(this.transform.parent);
                                            otherItemFromCharacterSystem.GetComponent <RectTransform>().localPosition = Vector3.zero;
                                            if (this.gameObject.transform.parent.parent.parent.GetComponent <Hotbar>() != null)
                                            {
                                                createDuplication(otherItemFromCharacterSystem);
                                            }

                                            this.gameObject.transform.SetParent(eS.transform.GetChild(1).GetChild(i));
                                            this.gameObject.GetComponent <RectTransform>().localPosition = Vector3.zero;
                                        }

                                        gearable = true;
                                        if (duplication != null)
                                        {
                                            Destroy(duplication.gameObject);
                                        }
                                        eS.gameObject.GetComponent <Inventory>().updateItemList();
                                        inventory.OnUpdateItemList();
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                if (!gearable && item.itemType != ItemType.UFPS_Ammo && item.itemType != ItemType.UFPS_Grenade)
                {
                    Item itemFromDup = null;
                    if (duplication != null)
                    {
                        itemFromDup = duplication.GetComponent <ItemOnObject>().item;
                    }

                    inventory.ConsumeItem(item);

                    item.itemValue--;
                    if (itemFromDup != null)
                    {
                        duplication.GetComponent <ItemOnObject>().item.itemValue--;
                        if (itemFromDup.itemValue <= 0)
                        {
                            if (tooltip != null)
                            {
                                tooltip.deactivateTooltip();
                            }
                            inventory.deleteItemFromInventory(item);
                            Destroy(duplication.gameObject);
                        }
                    }
                    if (item.itemValue <= 0)
                    {
                        if (tooltip != null)
                        {
                            tooltip.deactivateTooltip();
                        }
                        inventory.deleteItemFromInventory(item);
                        Destroy(this.gameObject);
                    }
                }
            }
        }
    }
Beispiel #14
0
    // Update is called once per frame
    void Update()
    {
        //Fonction test dégâts
        if (Input.GetKeyDown(KeyCode.P))
        {
            ApplyDamage(10);
        }

        float percentageHp = ((currentHealth * 100) / maxHealth) / 100;

        hpImage.fillAmount = percentageHp;

        float percentageMana = ((currentMana * 100) / maxMana) / 100;

        manaImage.fillAmount = percentageMana;

        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                characterSystemInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (!inventory.activeSelf)
            {
                mainInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                mainInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
        {
            if (!craftSystem.activeSelf)
            {
                craftSystemInventory.openInventory();
            }
            else
            {
                if (cS != null)
                {
                    cS.backToInventory();
                }
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                craftSystemInventory.closeInventory();
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        // Pour la barre de vie
        float percentHP = ((currentHealth * 100) / maxHealth) / 100;

        hpImage.fillAmount = percentHP;

        // Pour la barre de mana
        float percentMana = ((currentMana * 100) / maxMana) / 100;

        manaImage.fillAmount = percentMana;

        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                characterSystemInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (!inventory.activeSelf)
            {
                mainInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                mainInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
        {
            if (!craftSystem.activeSelf)
            {
                craftSystemInventory.openInventory();
            }
            else
            {
                if (cS != null)
                {
                    cS.backToInventory();
                }
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                craftSystemInventory.closeInventory();
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        goldText.text = "Gold : " + goldCoins;

        // + 50 xp

        /*if (Input.GetKeyDown(KeyCode.M))
         * {
         *  currentXP += 50;
         * }*/

        // Si on a assez d'XP
        if (currentXP >= maxXP)
        {
            float reste = currentXP - maxXP;
            playerLevel += 1;
            playerskills.availablePoints += 1;
            playerLevelTxt.text           = "Player Level : " + playerLevel;
            currentXP = 0 + reste;
            maxXP     = maxXP * rateXP;
        }

        // Pour la barre d'XP
        float percentageXP = ((currentXP * 100) / maxXP) / 100;

        experienceBar.fillAmount = percentageXP;

        // empecher la vie actuelle d'etre supérieur à la vie max
        if (currentHealth > maxHealth)
        {
            currentHealth = maxHealth;
        }

        // Pour la barre de vie
        float percentageHP = ((currentHealth * 100) / maxHealth) / 100;

        hpImage.fillAmount = percentageHP;

        // Pour la barre de mana
        float percentageMana = ((currentMana * 100) / maxMana) / 100;

        manaImage.fillAmount = percentageMana;

        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                characterSystemInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (!inventory.activeSelf)
            {
                mainInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                mainInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
        {
            if (!craftSystem.activeSelf)
            {
                craftSystemInventory.openInventory();
            }
            else
            {
                if (cS != null)
                {
                    cS.backToInventory();
                }
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                craftSystemInventory.closeInventory();
            }
        }
    }
Beispiel #17
0
    // Update is called once per frame
    void Update()
    {
        // Pour le changement de couleur
        if (skinTime <= 0)
        {
            if (!isInvincible)
            {
                skin.gameObject.GetComponent <Renderer>().material.color = skinOriginalColor;
            }
            else // invincible
            {
                skin.gameObject.GetComponent <Renderer>().material.color = Color.yellow;
            }
        }
        else
        {
            skinTime -= Time.deltaTime;
        }

        // Pour la barre de vie
        float percentageHP = ((currentHealth * 100) / maxHealth) / 100;

        hpImage.fillAmount = percentageHP;

        // Pour la barre de mana
        float percentageMana = ((currentMana * 100) / maxMana) / 100;

        manaImage.fillAmount = percentageMana;

        // Test pour les dégats ! à supprimer à la fin
        if (Input.GetKeyDown(KeyCode.L))
        {
            ApplyDamage(10);
        }

        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                characterSystemInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (!inventory.activeSelf)
            {
                mainInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                mainInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
        {
            if (!craftSystem.activeSelf)
            {
                craftSystemInventory.openInventory();
            }
            else
            {
                if (cS != null)
                {
                    cS.backToInventory();
                }
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                craftSystemInventory.closeInventory();
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (lifeSteal && currentHealth + lifeStealValue <= maxHealth)
        {
            currentHealth += (lifeStealValue / 500);

            UpdateHPBar();
        }
        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                characterSystemInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
            }
        }



        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (!inventory.activeSelf)
            {
                mainInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                mainInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
        {
            if (!craftSystem.activeSelf)
            {
                craftSystemInventory.openInventory();
            }
            else
            {
                if (cS != null)
                {
                    cS.backToInventory();
                }
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                craftSystemInventory.closeInventory();
            }
        }
    }
Beispiel #19
0
    // Update is called once per frame
    void Update()
    {
        float percentageHP = ((currentHealth) * 100 / maxHealth / 100);

        hpImage.fillAmount = percentageHP;
        txtHP.text         = currentHealth + "/" + maxHealth;

        float percentageMana = ((currentMana) * 100 / maxMana / 100);

        manaImage.fillAmount = percentageMana;
        txtMana.text         = currentMana + "/" + maxMana;

        float pourcentageXp = ((currentXp) * 100 / maxXp / 100);

        barreXp.fillAmount = pourcentageXp;
        txtExp.text        = currentXp + "/" + maxXp;

        if (Input.GetKeyDown(KeyCode.L))  //Test si la le gain d'exp marche
        {
            GainExp(120);
        }

        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                Cursor.visible   = true;
                Cursor.lockState = CursorLockMode.None;
                characterSystemInventory.openInventory();
            }
            else
            {
                Cursor.visible   = false;
                Cursor.lockState = CursorLockMode.Locked;
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (!inventory.activeSelf)
            {
                Cursor.visible   = true;
                Cursor.lockState = CursorLockMode.None;
                mainInventory.openInventory();
            }
            else
            {
                Cursor.visible   = false;
                Cursor.lockState = CursorLockMode.Locked;
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                mainInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
        {
            if (!craftSystem.activeSelf)
            {
                craftSystemInventory.openInventory();
            }
            else
            {
                if (cS != null)
                {
                    cS.backToInventory();
                }
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                craftSystemInventory.closeInventory();
            }
        }
    }
Beispiel #20
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                characterSystemInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (!inventory.activeSelf)
            {
                mainInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                mainInventory.closeInventory();
            }
        }

        /*if (Input.GetKeyDown(inputManagerDatabase.SkillsPanelKeyCode))
         * {
         *  if (!skillsPanel.activeSelf)
         *  {
         *      skillsInventory.openInventory();
         *  }
         *  else
         *  {
         *      if (toolTip != null)
         *          toolTip.deactivateTooltip();
         *      skillsInventory.closeInventory();
         *  }
         * }*/

        /*if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
         * {
         *  if (!craftSystem.activeSelf)
         *      craftSystemInventory.openInventory();
         *  else
         *  {
         *      if (cS != null)
         *          cS.backToInventory();
         *      if (toolTip != null)
         *          toolTip.deactivateTooltip();
         *      craftSystemInventory.closeInventory();
         *  }
         * }*/
    }
Beispiel #21
0
    public void OnPointerDown(PointerEventData data)
    {
        if (this.gameObject.transform.parent.parent.parent.GetComponent <EquipmentSystem>() == null)
        {
            bool      gearable  = false;
            Inventory inventory = transform.parent.parent.parent.GetComponent <Inventory>();

            if (eS != null)
            {
                itemTypeOfSlot = eS.itemTypeOfSlots;
            }

            if (data.button == PointerEventData.InputButton.Right)
            {
                //item from craft system to inventory
                if (transform.parent.GetComponent <CraftResultSlot>() != null)
                {
                    bool check = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>().inventory.GetComponent <Inventory>().checkIfItemAllreadyExist(item.itemID, item.itemValue);

                    if (!check)
                    {
                        GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>().inventory.GetComponent <Inventory>().addItemToInventory(item.itemID, item.itemValue);
                        GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>().inventory.GetComponent <Inventory>().stackableSettings();
                    }
                    CraftSystem cS = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>().craftSystem.GetComponent <CraftSystem>();
                    cS.deleteItems(item);
                    CraftResultSlot result = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>().craftSystem.transform.GetChild(3).GetComponent <CraftResultSlot>();
                    result.temp = 0;
                    //tooltip.deactivateTooltip();
                    gearable = true;
                    GameObject.FindGameObjectWithTag("MainInventory").GetComponent <Inventory>().updateItemList();
                }
                else
                {
                    bool stop = false;
                    if (eS != null)
                    {
                        for (int i = 0; i < eS.slotsInTotal; i++)
                        {
                            if (itemTypeOfSlot[i].Equals(item.itemType))
                            {
                                if (eS.transform.GetChild(1).GetChild(i).childCount == 0)
                                {
                                    stop = true;
                                    if (eS.transform.GetChild(1).GetChild(i).parent.parent.GetComponent <EquipmentSystem>() != null && this.gameObject.transform.parent.parent.parent.GetComponent <EquipmentSystem>() != null)
                                    {
                                    }
                                    else
                                    {
                                        inventory.EquiptItem(item);
                                    }

                                    this.gameObject.transform.SetParent(eS.transform.GetChild(1).GetChild(i));
                                    this.gameObject.GetComponent <RectTransform>().localPosition = Vector3.zero;
                                    eS.gameObject.GetComponent <Inventory>().updateItemList();
                                    inventory.updateItemList();
                                    gearable = true;
                                    if (duplication != null)
                                    {
                                        Destroy(duplication.gameObject);
                                    }
                                    break;
                                }
                            }
                        }


                        if (!stop)
                        {
                            for (int i = 0; i < eS.slotsInTotal; i++)
                            {
                                if (itemTypeOfSlot[i].Equals(item.itemType))
                                {
                                    if (eS.transform.GetChild(1).GetChild(i).childCount != 0)
                                    {
                                        GameObject otherItemFromCharacterSystem = eS.transform.GetChild(1).GetChild(i).GetChild(0).gameObject;
                                        Item       otherSlotItem = otherItemFromCharacterSystem.GetComponent <ItemOnObject>().item;
                                        if (item.itemType == ItemType.UFPS_Weapon)
                                        {
                                            inventory.UnEquipItem1(otherItemFromCharacterSystem.GetComponent <ItemOnObject>().item);
                                            inventory.EquiptItem(item);
                                        }
                                        else
                                        {
                                            inventory.EquiptItem(item);
                                            if (item.itemType != ItemType.Backpack)
                                            {
                                                inventory.UnEquipItem1(otherItemFromCharacterSystem.GetComponent <ItemOnObject>().item);
                                            }
                                        }
                                        if (this == null)
                                        {
                                            GameObject dropItem = (GameObject)Instantiate(otherSlotItem.itemModel);
                                            dropItem.AddComponent <PickUpItem>();
                                            dropItem.GetComponent <PickUpItem>().item = otherSlotItem;
                                            dropItem.transform.localPosition          = GameObject.FindGameObjectWithTag("Player").transform.localPosition;
                                            inventory.OnUpdateItemList();
                                        }
                                        else
                                        {
                                            otherItemFromCharacterSystem.transform.SetParent(this.transform.parent);
                                            otherItemFromCharacterSystem.GetComponent <RectTransform>().localPosition = Vector3.zero;
                                            if (this.gameObject.transform.parent.parent.parent.GetComponent <Hotbar>() != null)
                                            {
                                                createDuplication(otherItemFromCharacterSystem);
                                            }

                                            this.gameObject.transform.SetParent(eS.transform.GetChild(1).GetChild(i));
                                            this.gameObject.GetComponent <RectTransform>().localPosition = Vector3.zero;
                                        }

                                        gearable = true;
                                        if (duplication != null)
                                        {
                                            Destroy(duplication.gameObject);
                                        }
                                        eS.gameObject.GetComponent <Inventory>().updateItemList();
                                        inventory.OnUpdateItemList();
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                if (!gearable && item.itemType != ItemType.UFPS_Ammo && item.itemType != ItemType.UFPS_Grenade)
                {
                    Item itemFromDup = null;
                    if (duplication != null)
                    {
                        itemFromDup = duplication.GetComponent <ItemOnObject>().item;
                    }

                    inventory.ConsumeItem(item);

                    item.itemValue--;
                    if (itemFromDup != null)
                    {
                        duplication.GetComponent <ItemOnObject>().item.itemValue--;
                        if (itemFromDup.itemValue <= 0)
                        {
                            if (tooltip != null)
                            {
                                tooltip.deactivateTooltip();
                            }
                            inventory.deleteItemFromInventory(item);
                            Destroy(duplication.gameObject);
                        }
                    }
                    if (item.itemValue <= 0)
                    {
                        if (tooltip != null)
                        {
                            tooltip.deactivateTooltip();
                        }
                        inventory.deleteItemFromInventory(item);
                        Destroy(this.gameObject);
                    }
                }
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        //damage screen
        if (isDamaged)
        {
            damageScreenRepeatTime -= Time.deltaTime;
            if (damageScreenRepeatTime <= 0)
            {
                damageScreenGO.SetActive(false);
                damageScreenRepeatTime = damageScreenTime;
                isDamaged = false;
            }
        }

        //Pour la barre de vie
        float percentageHP = ((currentHealth * 100) / maxHealth) / 100;

        hpImage.fillAmount = percentageHP;

        //Pour la barre de mana
        float percentageMana = ((currentMana * 100) / maxMana) / 100;

        manaImage.fillAmount = percentageMana;

        //Pour la barre d'xp
        //assez d'xp
        if (currentXp >= maxXp)
        {
            float reste = currentXp - maxXp;
            playerLvl += 1;
            playerSkill.availablePoints  += pointCompetence;
            playerMagics.availablePoints += pointCompetence;
            currentXp = 0 + reste;
            maxXp     = maxXp * rateXp;
        }

        playerLevelTxt.text = "" + playerLvl;
        float percentageXp = ((currentXp * 100) / maxXp) / 100;

        experienceBar.fillAmount = percentageXp;

        //money
        AmountMoney.text = "gold: " + currentMoney;

        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                characterSystemInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (!inventory.activeSelf)
            {
                mainInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                mainInventory.closeInventory();
            }
        }


        if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
        {
            if (!craftSystem.activeSelf)
            {
                craftSystemInventory.openInventory();
            }
            else
            {
                if (cS != null)
                {
                    cS.backToInventory();
                }
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                craftSystemInventory.closeInventory();
            }
        }
    }
Beispiel #23
0
    // Update is called once per frame
    void Update()
    {
        UpdateHPBar();
        UpdateManaBar();

        if (currentHealth <= 0)
        {
            death = true;
            this.transform.gameObject.SetActive(false);
            Destroy(GameObject.FindGameObjectWithTag("MainCamera"));
            UnityEngine.SceneManagement.SceneManager.LoadSceneAsync("Spawn Town");
        }
        if (done == false)
        {
            menu.transform.GetChild(0).GetComponent <Button> ().onClick.AddListener(() => { control.Save(); });
            done = true;
        }
        currentDamage = maxDamage;

        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                print("open");
                characterSystemInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (!inventory.activeSelf)
            {
                mainInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                mainInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
        {
            if (!craftSystem.activeSelf)
            {
                craftSystemInventory.openInventory();
            }
            else
            {
                if (cS != null)
                {
                    cS.backToInventory();
                }
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                craftSystemInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (!menu.activeSelf)
            {
                menu.SetActive(true);
            }
            else
            {
                menu.SetActive(false);
            }
        }
    }
Beispiel #24
0
    // Update is called once per frame
    void Update()
    {
        mainInventory.openInventory();

        if (!isAlready)
        {
            //an nut "u" de update lai inventory
            #region
            //if (Input.GetKeyDown("u"))
            {
                //mainInventory.deleteAllItems();
                isBeingDeleted = true;
            }
            if (isBeingDeleted)
            {
                timeWaitDelete += Time.deltaTime;
            }
            //if (timeWaitDelete >= 1)
            {
                isBeingDeleted = false;
                timeWaitDelete = 0;

                //string loadResult = Load("NayThiLoadFileTextInventory.txt");
                //string[] listItem = loadResult.Split(';');
                string[] listItem = new string[3];
                listItem.SetValue("36", 0);
                listItem.SetValue("37", 1);
                listItem.SetValue("38", 2);
                foreach (var item in listItem)
                {
                    mainInventory.addItemToInventory(int.Parse(item), int.Parse(item));
                }

                foreach (var item in GameObject.FindGameObjectsWithTag("Item"))
                {
                    item.transform.localScale = new Vector3(2, 2, 1);
                }

                foreach (var item in GameObject.FindGameObjectsWithTag("Item"))
                {
                    Text itemText = item.transform.GetChild(1).GetComponent <Text>();
                    foreach (Transform child in item.transform)
                    {
                        if (child.name.Equals("Text"))
                        {
                            if (child.GetComponent <Text>() != null)
                            {
                                child.GetComponent <Text>().enabled = true;
                            }
                            child.GetComponent <RectTransform>().anchoredPosition = new Vector2(13f, 13f);
                        }
                    }
                }
            }

            isAlready = true;
        }
        #endregion

        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                characterSystemInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (!inventory.activeSelf)
            {
                mainInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                mainInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
        {
            if (!craftSystem.activeSelf)
            {
                craftSystemInventory.openInventory();
            }
            else
            {
                if (cS != null)
                {
                    cS.backToInventory();
                }
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                craftSystemInventory.closeInventory();
            }
        }
    }
Beispiel #25
0
    public void consumeIt()
    {
        Inventory inventory = transform.parent.parent.parent.GetComponent <Inventory>();

        bool gearable = false;

        if (GameObject.FindGameObjectWithTag("EquipmentSystem") != null)
        {
            eS = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerInventory>().characterSystem.GetComponent <EquipmentSystem>();
        }

        if (eS != null)
        {
            itemTypeOfSlot = eS.itemTypeOfSlots;
        }

        Item itemFromDup = null;

        if (duplication != null)
        {
            itemFromDup = duplication.GetComponent <ItemOnObject>().item;
        }

        bool stop = false;

        if (eS != null)
        {
            for (int i = 0; i < eS.slotsInTotal; i++)
            {
                if (itemTypeOfSlot[i].Equals(item.itemType))
                {
                    if (eS.transform.GetChild(1).GetChild(i).childCount == 0)
                    {
                        stop = true;
                        this.gameObject.transform.SetParent(eS.transform.GetChild(1).GetChild(i));
                        this.gameObject.GetComponent <RectTransform>().localPosition = Vector3.zero;
                        eS.gameObject.GetComponent <Inventory>().updateItemList();
                        inventory.updateItemList();
                        inventory.EquiptItem(item);
                        gearable = true;
                        if (duplication != null)
                        {
                            Destroy(duplication.gameObject);
                        }
                        break;
                    }
                }
            }

            if (!stop)
            {
                for (int i = 0; i < eS.slotsInTotal; i++)
                {
                    if (itemTypeOfSlot[i].Equals(item.itemType))
                    {
                        if (eS.transform.GetChild(1).GetChild(i).childCount != 0)
                        {
                            GameObject otherItemFromCharacterSystem = eS.transform.GetChild(1).GetChild(i).GetChild(0).gameObject;
                            Item       otherSlotItem = otherItemFromCharacterSystem.GetComponent <ItemOnObject>().item;
                            if (item.itemType == ItemType.UFPS_Weapon)
                            {
                                inventory.UnEquipItem1(otherItemFromCharacterSystem.GetComponent <ItemOnObject>().item);
                                inventory.EquiptItem(item);
                            }
                            else
                            {
                                inventory.EquiptItem(item);
                                if (item.itemType != ItemType.Backpack)
                                {
                                    inventory.UnEquipItem1(otherItemFromCharacterSystem.GetComponent <ItemOnObject>().item);
                                }
                            }
                            if (this == null)
                            {
                                GameObject dropItem = (GameObject)Instantiate(otherSlotItem.itemModel);
                                dropItem.AddComponent <PickUpItem>();
                                dropItem.GetComponent <PickUpItem>().item = otherSlotItem;
                                dropItem.transform.localPosition          = GameObject.FindGameObjectWithTag("Player").transform.localPosition;
                                inventory.OnUpdateItemList();
                            }
                            else
                            {
                                otherItemFromCharacterSystem.transform.SetParent(this.transform.parent);
                                otherItemFromCharacterSystem.GetComponent <RectTransform>().localPosition = Vector3.zero;
                                if (this.gameObject.transform.parent.parent.parent.GetComponent <Hotbar>() != null)
                                {
                                    createDuplication(otherItemFromCharacterSystem);
                                }

                                this.gameObject.transform.SetParent(eS.transform.GetChild(1).GetChild(i));
                                this.gameObject.GetComponent <RectTransform>().localPosition = Vector3.zero;
                            }

                            gearable = true;
                            if (duplication != null)
                            {
                                Destroy(duplication.gameObject);
                            }
                            eS.gameObject.GetComponent <Inventory>().updateItemList();
                            inventory.OnUpdateItemList();
                            break;
                        }
                    }
                }
            }
        }
        if (!gearable && item.itemType != ItemType.UFPS_Ammo && item.itemType != ItemType.UFPS_Grenade)
        {
            if (duplication != null)
            {
                itemFromDup = duplication.GetComponent <ItemOnObject>().item;
            }

            inventory.ConsumeItem(item);

            item.itemValue--;
            if (itemFromDup != null)
            {
                duplication.GetComponent <ItemOnObject>().item.itemValue--;
                if (itemFromDup.itemValue <= 0)
                {
                    if (tooltip != null)
                    {
                        tooltip.deactivateTooltip();
                    }
                    inventory.deleteItemFromInventory(item);
                    Destroy(duplication.gameObject);
                }
            }
            if (item.itemValue <= 0)
            {
                if (tooltip != null)
                {
                    tooltip.deactivateTooltip();
                }
                inventory.deleteItemFromInventory(item);
                Destroy(this.gameObject);
            }
        }
    }
Beispiel #26
0
    // Update is called once per frame
    void Update()
    {
        percentageHp        = ((currentHealth * 100) / maxHealth) / 100;
        hpImage.fillAmount  = percentageHp;
        percentageExp       = ((currentExp * 100) / expToLevelUp) / 100;
        expImage.fillAmount = percentageExp;

        //Tests damage
        if (Input.GetKeyDown(KeyCode.L))
        {
            ApplyDamage(10);
        }

        if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
        {
            if (!characterSystem.activeSelf)
            {
                characterSystemInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                characterSystemInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (!inventory.activeSelf)
            {
                mainInventory.openInventory();
            }
            else
            {
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                if (GameObject.FindGameObjectWithTag("PanelAccueil").transform.childCount > 0)
                {
                    GameObject.FindGameObjectWithTag("PanelAccueil").transform.GetComponent <RecettePanelAffichage>().close();
                }
                mainInventory.closeInventory();
            }
        }

        if (Input.GetKeyDown(inputManagerDatabase.CraftSystemKeyCode))
        {
            if (!craftSystem.activeSelf)
            {
                craftSystemInventory.openInventory();
            }
            else
            {
                if (cS != null)
                {
                    cS.backToInventory();
                }
                if (toolTip != null)
                {
                    toolTip.deactivateTooltip();
                }
                craftSystemInventory.closeInventory();
                for (int i = 0; i < blueprintDatabase.blueprints.Count; i++)
                {
                    blueprintDatabase.blueprints[i].amountOfFinalItem = 1;
                }
            }
        }
    }