public void useItem() { // GameObject[] playerItems // int itemIndex = selectedItem; itemData item = inventoryController.partyInventory[selectedItem].GetComponent <itemData>(); GameObject target = targets[selectedTarget]; characterStatusController targetStatus = target.GetComponent <characterStatusController>(); inventoryController.useItem(selectedItem); itemBattleController itemController = playerItems[selectedItemNum].GetComponent <itemBattleController>(); itemController.itemCount--; if (itemController.itemCount > 0) { itemController.itemCountText.text = itemController.itemCount.ToString(); } else { foreach (GameObject playerItem in playerItems) { Destroy(playerItem); } numItems = 0; loadItems(); } targetStatus.calculateDamage(item); targetMenu.SetActive(false); itemsMenu.SetActive(false); selectedItem = -1; selectedTarget = -1; }
public void useSkill() { skillData skill = charaSkills[selectedSkill + 2]; GameObject target = targets[selectedTarget]; characterStatusController targetStatus = target.GetComponent <characterStatusController>(); battleSkillController skillController = skillItems[selectedSkill].GetComponent <battleSkillController>(); skillController.skillTimer = skillController.rechargeTime + skillController.castingTime; playerCharaStatuses[selectedCharacter].currentMP -= skill.MPCost; targetStatus.calculateDamage(skill, playerParty[selectedCharacter]); targetMenu.SetActive(false); skillsMenu.SetActive(false); selectedSkill = -1; selectedTarget = -1; }