public TextMeshProUGUI[] scoreText;
void ScoreTimeLogic(){
ย ย ย ย scoreText[0].text = string.Format("{0:n0}",playerinfo.score);
ย ย ย ย scoreText[1].text = string.Format("{0:n0}",playerinfo.score);
ย ย ย ย scoreText[2].text = string.Format("{0:n0}",playerinfo.score);
ย ย ย ย scoreText[3].text = string.Format("{0:n0}",playerinfo.score);
์ด๋ ๊ฒ ๊ณ์ ํ๋ฌด ๋ฐฐ์ด์ ์ค์๋ ์๋๋ฐ ๋ฐฐ์ด ์ ์ฒด๋ฅผ ์นญํ๋ ๊ฒ ์์ผ๋ฉด
ย ย ย ย for(int i =0; i >= 3; i++){
ย ย ย ย scoreText[0].text = string.Format("{0:n0}",playerinfo.score);
ย ย ย ย scoreText[1].text = string.Format("{0:n0}",playerinfo.score);
ย ย ย ย scoreText[2].text = string.Format("{0:n0}",playerinfo.score);
ย ย ย ย scoreText[3].text = string.Format("{0:n0}",playerinfo.score);
ย ย }
์ด๋ ๊ฒ ์จ๋ ๋๋ ค๋?
1. Length ์์ฑ์ผ๋ก ๋ฐฐ์ด ํฌ๊ธฐ๋ฅผ ์ ์ ์์ 2. ๊ฐฑ์ ์ฃผ๊ธฐ๊ฐ ํ๋ ์ ๋จ์๊ฐ ์๋๋ฉด ์ฌํํ๊ฒ foreach
3. ๋๋ฒ ์งธ ์ท์ฒ๋ผ scoreText ๋ฐฐ์ด์ฒจ์๋ฅผ ๊ณ ์ ํ๋ฉด for๋ฌธ ์๋ฏธ๊ฐ ์์ง
for๋ฌธ ์กฐ๊ฑด์๋ ์ด์ํ๊ณ ๋ค์ฌ์ฐ๊ธฐ๋ ์ด์ํ๊ณ ๋ณธ๋ฌธ๋ ์ด์ํ๊ณ ์ด์ฒด์ ๋๊ตญ์ด๋ค
ในใ
์์๋ฃ๊ฒํด๋ผ
๋ฐฑ์ค ์ค๋ฒ ๋ฐ๊ณ ์ค์
ใ ใท