// 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() { 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 (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(); } } }
// 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(); } } }
// 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(); } } }
// 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() { 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(); } } }
// 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() { 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(); } } }
// 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; } } } }