closeInventory() public method

public closeInventory ( ) : void
return void
    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();
            }
        }
    }
    // 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();
            }
        }
    }
示例#3
0
 public void OnPointerDown(PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Left)
     {
         inv.closeInventory();
     }
 }
示例#4
0
    // 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();
            }
        }
    }
 public void OnPointerDown(PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Left)
     {
         GameObject empty = new GameObject();
         empty.AddComponent<SetPlay>();
         Destroy(empty, 1.0f);
         inv.closeInventory();
     }
 }
示例#6
0
    // Update is called once per frame
    void Update()
    {
        float distance = Vector3.Distance(this.gameObject.transform.position, GameObject.FindGameObjectWithTag("Player").transform.position);

        if (Input.GetKeyDown(openInventory) && distance <= distanceToOpenWorkingStation)
        {
            showCraftSystem = !showCraftSystem;
            if (showCraftSystem)
            {
                craftInventory.openInventory();
            }
            else
            {
                cS.backToInventory();
                craftInventory.closeInventory();
            }
        }
        if (showCraftSystem && distance > distanceToOpenWorkingStation)
        {
            cS.backToInventory();
            craftInventory.closeInventory();
        }
    }
示例#7
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
        {
            if (mainInventory.isInvClosed())
            {
                mainInventory.openInventory();
            }
            else
            {
                mainInventory.closeInventory();
            }
        }
        if (Input.GetKeyDown(inputManagerDatabase.CharPanelKeyCode))
        {
            if (mainInventory.isCharPanelClosed())
            {
                mainInventory.openCharPanel();
            }
            else
            {
                mainInventory.closeCharPanel();
            }
        }
        if (Input.GetKeyDown(inputManagerDatabase.CraftPanelKeyCode))
        {
            if (mainInventory.isCraftPanelClosed())
            {
                mainInventory.openCraftPanel();
            }
            else
            {
                mainInventory.closeCraftPanel();
            }
        }

        currentTime = gameTime.GetTime();
        if ((currentTime - previousTime) > 60)
        {
            previousTime = currentTime;
            if (hydration > 30)
            {
                energy    = energy - ((currentTime) / 60);
                hydration = hydration - ((currentTime) / 30);
                //Debug.Log(currentTime);
                stamina = stamina - ((currentTime) / 60);
                UpdateAll();
            }
        }
    }
示例#8
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
     {
         if (!inventory.activeSelf)
         {
             mainInventory.openInventory();
         }
         else
         {
             mainInventory.closeInventory();
         }
     }
 }
示例#9
0
 public void OnEquipInventory()
 {
     if (!characterSystem.activeSelf)
     {
         characterSystemInventory.openInventory();
     }
     else
     {
         if (toolTip != null)
         {
             toolTip.deactivateTooltip();
         }
         characterSystemInventory.closeInventory();
     }
 }
示例#10
0
 public void OnInventory()
 {
     if (!inventory.activeSelf)
     {
         mainInventory.openInventory();
     }
     else
     {
         if (toolTip != null)
         {
             toolTip.deactivateTooltip();
         }
         mainInventory.closeInventory();
     }
 }
示例#11
0
 public void OnPointerDown(PointerEventData eventData)
 {
     if (eventData.button == PointerEventData.InputButton.Left)
     {
         inv.closeInventory();
         if (transform.parent.tag.Equals("CraftSystem"))
         {
             transform.parent.GetComponent <CraftSystem>().backToInventory();
         }
         if (transform.parent.tag.Equals("MainInventory"))
         {
             if (GameObject.FindGameObjectWithTag("PanelAccueil").transform.childCount > 0)
             {
                 GameObject.FindGameObjectWithTag("PanelAccueil").transform.GetComponent <RecettePanelAffichage>().close();
             }
         }
     }
 }
示例#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();
         }
     }
 }
示例#13
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);
            }
        }
    }
示例#14
0
        private void Update()
        {
            if (!m_Jump)
            {
                m_Jump = Input.GetButtonDown("Jump");
            }
            if (battle)
            {
                setLimits();
                mainInventory.closeInventory();
                characterSystemInventory.closeInventory();
                float hp   = currentHealth;
                float mana = currentMana;
                if (healthBar == null || ManaBar == null)
                {
                    healthBar = (Camera.main.transform.FindChild("Canvas").FindChild("PlayerHealth").FindChild("PlayerLife")).gameObject;
                    ManaBar   = (Camera.main.transform.FindChild("Canvas").FindChild("PlayerMana").FindChild("PlayerMana")).gameObject;
                }

                if (healthBar.transform.localScale.x * 100 != hp)
                {
                    print("entrei no id da vida");
                    Vector3 temp = healthBar.transform.localScale;
                    temp.x = hp / 100f;
                    if (hp / 100 < 0)
                    {
                        temp.x = 0;
                    }
                    healthBar.transform.localScale = temp;
                }
                if (ManaBar.transform.localScale.x * 50 != mana)
                {
                    Vector3 temp = ManaBar.transform.localScale;
                    temp.x = mana / 100f;
                    if (mana / 100 < 0)
                    {
                        temp.x = 0;
                    }
                    ManaBar.transform.localScale = temp;
                }

                GameObject enemy = GameObject.FindGameObjectWithTag("Enemy");
                EnemyScript = enemy.GetComponent <SkeletonBehavior>();

                if (hp <= 0)
                {
                    defeat.SetActive(true);
                    buttonContinue.SetActive(true);
                    battle             = false;
                    EnemyScript.battle = false;
                }
            }
            else
            {
                if (Input.GetKeyDown(inputManagerDatabase.CharacterSystemKeyCode))
                {
                    if (!characterSystem.activeSelf)
                    {
                        characterSystemInventory.openInventory();
                    }
                    else
                    {
                        characterSystemInventory.closeInventory();
                    }
                }

                if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
                {
                    if (!inventory.activeSelf)
                    {
                        mainInventory.openInventory();
                    }
                    else
                    {
                        mainInventory.closeInventory();
                    }
                }
            }
        }
示例#15
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();
            }
        }
    }
示例#16
0
    // 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();
            }
        }
    }
示例#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();
            }
        }
    }
示例#18
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();
            }
        }
    }
示例#19
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;
                }
            }
        }
    }
示例#20
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();
            }
        }
    }
    // 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();
            }
        }
    }
示例#22
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();
         *  }
         * }*/
    }
    // 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();
            }
        }
    }
示例#24
0
    // 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();
            }
        }
    }