enum for 문으로 검색하여 딕셔너리 에 집어넣기( 문자 형변환 )
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using System.Linq;
using Enum = System.Enum;
public class GameMagNew : MonoBehaviour {
public Text DISTEXT;
public GameObject[] FLOORS;
IDictionary<string, GameObject> FLOORSDIC = new Dictionary<string, GameObject>();
enum FloorState
{
NONE = 0,
ONE,
TOW,
THREE,
FOR,
FIVE
}
FloorState FloorStat = FloorState.NONE;
void Start () {
for (int i = 1; i < (int)FloorState.FIVE; i++)
{
FloorStat = (FloorState)i;
FLOORSDIC[FloorStat.ToString()] = FLOORS[i];
}
}
void Update()
{
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using System.Linq;
using Enum = System.Enum;
public class GameMagNew : MonoBehaviour {
public Text DISTEXT;
public GameObject[] FLOORS;
IDictionary<string, GameObject> FLOORSDIC = new Dictionary<string, GameObject>();
enum FloorState
{
NONE = 0,
ONE,
TOW,
THREE,
FOR,
FIVE
}
FloorState FloorStat = FloorState.NONE;
void Start () {
for (int i = 1; i < (int)FloorState.FIVE; i++)
{
FloorStat = (FloorState)i;
FLOORSDIC[FloorStat.ToString()] = FLOORS[i];
}
}
void Update()
{
}
}
댓글
댓글 쓰기