NEW Project .1

윤재학·2022년 7월 11일

Project ( RRD )

목록 보기
2/4
 public List<GameObject> runeList; 
 // 룬을 담을 리스트
 public Dictionary<int, Rune> runeDictionary;
 // 룬을 담은 딕셔너리
 
 void Start() // 딕셔너리에 룬에 리스트를 넣어준다.
  RuneDictionary = new Dictionary<int, Rune>();
        for (int i = 0; i < RuneList.Count; ++i)
        {
            RuneDictionary.Add(RuneList[i].GetComponent<Rune>().RuneNumber, RuneList[i].GetComponent<Rune>());
        }


// 룬을 업그레이드 시키는 함수
runeDictionary[Constant.WIND_RUNE].GetComponent<WindRune>().RuneDamage +=Constant.POWER_UP_DAMAGE;

룬을 업그레이드를 시키면 프리펩이 강화가 된다.
하지만 게임을 종료하면 그 룬은 강화가 된 상태로 게임이 종료 되는데
그럼 다음 게임 때 강화가 된 상태로 게임이 시작된다.

해결

start에 룬리스트에 담겨있는 애들에 스크립트에 있는 Awake로 초기화를 시켜준다. ( Awake 안에 각 Rune 별로 초기화를 해두었다)

 RuneList[i].GetComponent<Rune>().Awake();
profile
노력하자 즐겁게 개발할수 있는 환경을 위해

0개의 댓글