using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerItemInv : MonoBehaviour { public enum ItemType { Sikaku, maru, ken, Escape1, Defense1, }; public Dictionary<ItemType, int> ItemKoDictionary = new Dictionary<ItemType, int>(); public Dictionary<ItemType, bool> ItemDictionary = new Dictionary<ItemType, bool>(); // Start is called before the first frame update void Start() { ItemKoDictionary [ItemType. Sikaku] = 0; ItemKoDictionary [ItemType. maru] = 0; ItemKoDictionary [ItemType. ken] = 0; ItemKoDictionary [ItemType. Escape1] = 0; ItemKoDictionary [ItemType. Defense1] = 0; } // Update is called once per frame void Update() { if(ItemKoDictionary [ItemType. Sikaku] == 0) {ItemDictionary[ItemType. Sikaku] = false;} if(ItemKoDictionary [ItemType.maru] == 0) {ItemDictionary [ItemType.maru] = false;} if(ItemKoDictionary [ItemType. ken] == 0) {ItemDictionary [ItemType. ken] = false;} if(ItemKoDictionary [ItemType.Escape1] == 0) {ItemDictionary [ItemType.Escape1] = false;} if(ItemKoDictionary [ItemType. Defense1] ==0) {ItemDictionary [ItemType. Defense1] =false;} if(ItemKoDictionary [ItemType. Sikaku] >= 1) {ItemDictionary[ItemType. Sikaku] = true;} if(ItemKoDictionary [ItemType.maru] >= 1) {ItemDictionary [ItemType.maru] =true;} if(ItemKoDictionary [ItemType. ken] >= 1) {ItemDictionary [ItemType. ken] = true;} if(ItemKoDictionary [ItemType.Escape1] >= 1) {ItemDictionary [ItemType.Escape1] = true;} if(ItemKoDictionary [ItemType. Defense1] >= 1) {ItemDictionary [ItemType. Defense1] =true;} Debug.Log("数字" + (int)ItemType. Defense1); Debug.Log("文字" + ItemDictionary.GetBool("Sikaku")); } }
Debug.Log("文字" + ItemDictionary.GetBool("Sikaku"));
enum型にいれた数字などを知りたいのですがどうすればいいでしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/03/30 02:06
2020/03/30 04:04
2020/03/30 13:24
2020/03/30 16:27
2020/03/30 23:03
2020/03/31 05:39
2020/03/31 07:12
2020/03/31 15:12
2020/03/31 22:37