openInventory() public method

public openInventory ( ) : void
return void
コード例 #1
0
    // 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();
            }
        }
    }
コード例 #2
0
 void bagListener()
 {
     if (!openInventory && !openMap)
     {
         inventory.openInventory();
         openInventory = true;
     }
 }
コード例 #3
0
    void Start()
    {
        //if (HPMANACanvas != null)
        //{
        //    hpText = HPMANACanvas.transform.GetChild(1).GetChild(0).GetComponent<Text>();

        //    manaText = HPMANACanvas.transform.GetChild(2).GetChild(0).GetComponent<Text>();

        //    hpImage = HPMANACanvas.transform.GetChild(1).GetComponent<Image>();
        //    manaImage = HPMANACanvas.transform.GetChild(1).GetComponent<Image>();

        //    UpdateHPBar();
        //    UpdateManaBar();
        //}

        if (inputManagerDatabase == null)
        {
            inputManagerDatabase = (InputManager)Resources.Load("InputManager");
        }

        if (craftSystem != null)
        {
            cS = craftSystem.GetComponent <CraftSystem>();
        }

        if (GameObject.FindGameObjectWithTag("Tooltip") != null)
        {
            toolTip = GameObject.FindGameObjectWithTag("Tooltip").GetComponent <Tooltip>();
        }
        if (inventory != null)
        {
            mainInventory = inventory.GetComponent <Inventory>();
        }
        if (characterSystem != null)
        {
            characterSystemInventory = characterSystem.GetComponent <Inventory>();
        }
        if (craftSystem != null)
        {
            craftSystemInventory = craftSystem.GetComponent <Inventory>();
        }

        mainInventory.openInventory();
    }
コード例 #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();
            }
        }
    }
コード例 #5
0
    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();
            }
        }
    }
コード例 #6
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(inputManagerDatabase.InventoryKeyCode))
     {
         if (!inventory.activeSelf)
         {
             mainInventory.openInventory();
         }
         else
         {
             mainInventory.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
ファイル: UI_Game.cs プロジェクト: behiever/kbengineTestGame
 public void OnEquipInventory()
 {
     if (!characterSystem.activeSelf)
     {
         characterSystemInventory.openInventory();
     }
     else
     {
         if (toolTip != null)
         {
             toolTip.deactivateTooltip();
         }
         characterSystemInventory.closeInventory();
     }
 }
コード例 #9
0
ファイル: UI_Game.cs プロジェクト: behiever/kbengineTestGame
 public void OnInventory()
 {
     if (!inventory.activeSelf)
     {
         mainInventory.openInventory();
     }
     else
     {
         if (toolTip != null)
         {
             toolTip.deactivateTooltip();
         }
         mainInventory.closeInventory();
     }
 }
コード例 #10
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();
         }
     }
 }
コード例 #11
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();
        }
    }
コード例 #12
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();
                    }
                }
            }
        }
コード例 #13
0
    void processInput()
    {
        Vector2 dir = Vector2.zero;

        // jika tidak lagi open merchant
        if (!flagM && !flagP)
        {
            // movement keybind
            if (Input.GetKey(KeyCode.A))
            {
                dir.x = -1;
            }
            else if (Input.GetKey(KeyCode.D))
            {
                dir.x = 1;
            }
            if (Input.GetKey(KeyCode.W))
            {
                dir.y = 1;
            }
            else if (Input.GetKey(KeyCode.S))
            {
                dir.y = -1;
            }


            // item keybind
            if (Input.GetKeyDown(KeyCode.Alpha1))
            {
                idxItem = 0;
                flagi   = true;
            }
            if (Input.GetKeyDown(KeyCode.Alpha2))
            {
                idxItem = 1;
                flagi   = true;
            }
            if (Input.GetKeyDown(KeyCode.Alpha3))
            {
                idxItem = 2;
                flagi   = true;
            }
            if (flagi)
            {
                flagi = false;
                for (int i = 0; i < 3; i++)
                {
                    if (i == idxItem)
                    {
                        activeItem[i].SetActive(true);
                    }
                    else
                    {
                        activeItem[i].SetActive(false);
                    }
                }
            }



            //flashlihght
            if (Input.GetKeyDown(KeyCode.F))
            {
                // turn off flashlight
                if (fstate)
                {
                    lightPlayer.intensity = 0;
                    fstate = false;
                }
                else
                {
                    lightPlayer.intensity = flashLife;
                    fstate = true;
                }
            }


            // Reload senter
            if (Input.GetKeyDown(KeyCode.R))
            {
                reloadBattery();
            }


            // Crafting item
            if (Input.GetKeyDown(KeyCode.C))
            {
                // Ke UI craft
                // setiap item yang dicraft akan mengurangi raw item dan menambah 1 item
                inventory.openInventory();
            }


            // use item
            if (Input.GetKeyDown(KeyCode.G))
            {
                // 0 : burning cloth
                // 1 : bottle
                // 2 : Health
                if (items[idxItem] - 1 >= 0)
                {
                    items[idxItem]--;
                    if (idxItem != 2)
                    {
                        Instantiate(PFitem[idxItem]);
                    }
                    else
                    {
                        if (currentHealth + 30 <= maxHealth)
                        {
                            currentHealth += 30;
                        }
                        else
                        {
                            currentHealth = maxHealth;
                        }
                        healthBar.SetHealth(currentHealth);
                    }
                    updateCtrItem();
                }
                else
                {
                    Debug.Log("Don't have any");
                }
            }


            // view objective
            if (Input.GetKeyDown(KeyCode.O))
            {
                objective.SetActive(!objective.active);
            }
        }


        // pickup item and interact with merchant
        if (Input.GetKeyDown(KeyCode.E))
        {
            // jika diarea merchant, open merchant
            checkMerchant();

            // cuman bisa pickup rawItem
            if (pickedUp != null)
            {
                if (pickedUp.tag == "rawItem")
                {
                    if (countBackpack() + 0.8 <= maxBackpack)
                    {
                        // cek collider dia ambil item apa
                        string namaItem = pickedUp.name;
                        int    idx      = -1;
                        if (namaItem.Contains("Batrei"))
                        {
                            idx = 0;
                        }
                        else if (namaItem.Contains("Alkohol"))
                        {
                            idx = 1;
                        }
                        else if (namaItem.Contains("Cloth"))
                        {
                            idx = 2;
                        }
                        else if (namaItem.Contains("Kabel"))
                        {
                            idx = 3;
                        }
                        else if (namaItem.Contains("Besi"))
                        {
                            idx = 4;
                        }
                        else if (namaItem.Contains("Botol"))
                        {
                            idx = 5;
                        }
                        else if (namaItem.Contains("Duct Tape"))
                        {
                            idx = 6;
                        }
                        Debug.Log(namaItem);
                        rawItems[idx]++;
                        destroyItem();
                        pickedUp = null;
                        updateCtrItem();
                    }
                    else
                    {
                        Debug.Log("Your Backpack is full");
                    }
                }
                else if (pickedUp.tag == "Item")
                {
                    if (countBackpack() + 1 <= maxBackpack)
                    {
                        // cek collider dia ambil item apa
                        string namaItem = pickedUp.name;
                        int    idx      = -1;
                        if (namaItem.Contains("Burning Cloth"))
                        {
                            idx = 0;
                        }
                        else if (namaItem.Contains("Decoy Bottle"))
                        {
                            idx = 1;
                        }
                        else if (namaItem.Contains("Bandage"))
                        {
                            idx = 2;
                        }
                        Debug.Log(namaItem);
                        items[idx]++;
                        destroyItem();
                        pickedUp = null;
                        updateCtrItem();
                    }
                    else
                    {
                        Debug.Log("Your Backpack is full");
                    }
                }
                else if (pickedUp.tag == "Key")
                {
                    // show text dapat keynya
                    pickedUp.GetComponent <objectiveController>().reqTextGO.GetComponent <reqTextController>().showText();
                    pickedUp.GetComponent <objectiveController>().reqTextGO.GetComponent <TextMeshProUGUI>().text = $"Got {pickedUp.name}";

                    keys.Add(pickedUp.name);
                    destroyItem();
                    pickedUp = null;
                }
                else if (pickedUp.tag == "Chest")
                {
                    if (checkPickedupReqObj())
                    {
                        pickedUp.GetComponent <keySpawner>().destroyChest();
                    }
                }
                else if (pickedUp.tag == "Door")
                {
                    if (checkPickedupReqObj())
                    {
                        // script door ambil next location dan tp kesana
                        pickedUp.GetComponent <doorController>().tp();
                    }
                }
                else if (pickedUp.tag == "Gate")
                {
                    if (checkPickedupReqObj())
                    {
                        pickedUp.GetComponent <OpenGate>().openGate();
                    }
                }
                else if (pickedUp.tag == "Paper")
                {
                    if (!keys.Contains(pickedUp.name))
                    {
                        keys.Add(pickedUp.name);
                    }
                    pickedUp.GetComponent <OpenPaper>().openText();
                    if (flagP)
                    {
                        pickedUp.GetComponent <objectiveController>().showTextReq();
                        pickedUp.GetComponent <objectiveController>().finishAndNewObjective();
                    }
                    flagP = !flagP;
                }
                else if (pickedUp.tag == "ControlRoom")
                {
                    string roomName = "";
                    if (keys.Contains("Office Top"))
                    {
                        roomName = "Office Center";
                        keys.Remove("Office Top");
                        keys.Add("Office Center");
                    }
                    else if (keys.Contains("Office Center"))
                    {
                        roomName = "Office Bottom";
                        keys.Remove("Office Center");
                        keys.Add("Office Bottom");
                    }
                    else if (keys.Contains("Office Bottom"))
                    {
                        roomName = "Office Top";
                        keys.Remove("Office Bottom");
                        keys.Add("Office Top");
                    }
                    pickedUp.GetComponent <objectiveController>().reqTextGO.GetComponent <reqTextController>().showText();
                    pickedUp.GetComponent <objectiveController>().reqTextGO.GetComponent <TextMeshProUGUI>().text = $"Switched to {roomName}";
                }
            }
        }


        // kurangi flashlight life
        if (fstate)
        {
            flashLife            -= (float)0.00001;
            lightPlayer.intensity = flashLife;
            if (flashLife <= 0)
            {
                lightPlayer.intensity = 0;
            }
        }

        dir.Normalize();

        rb.velocity = speed * dir;
    }
コード例 #14
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();
            }
        }
    }
コード例 #15
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();
            }
        }
    }
コード例 #16
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();
            }
        }
    }
コード例 #17
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();
            }
        }
    }
コード例 #18
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();
            }
        }
    }
コード例 #19
0
 void openInventory()
 {
     inventory.openInventory();
 }
コード例 #20
0
ファイル: PlayerInventory.cs プロジェクト: jinxka/On_The_Road
    // 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();
         *  }
         * }*/
    }
コード例 #21
0
    // 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()
    {
        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);
            }
        }
    }
コード例 #23
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();
            }
        }
    }
コード例 #24
0
    // 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();
            }
        }
    }
コード例 #25
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;
                }
            }
        }
    }