viewimage.php?id=2abcdd23dad63db0&no=24b0d769e1d32ca73cec8efa11d02831ed3c848cabfee483347b0cb094aa03c540bde19d2bf0471f6e41a5e7509ea16dc76e198be08d7ca51ca17fd79ca1a804178124

์ € ๋ฒ„ํŠผ ๋ˆŒ๋Ÿฌ์„œ ์ €๋Ÿฐ ํ˜•ํƒœ์˜ Summon ํ•จ์ˆ˜ ์ž‘๋™์‹œํ‚ค๊ณ  ์‹ถ์€๋ฐ

์•„๋ฌด๋ฆฌ ์ฐพ์•„๋ด๋„ ์ €๋Ÿฐ ํ˜•์‹์œผ๋ก  ๋ชปํ•˜๊ณ  ๊ฒŒ์ž„ ๋„๊ธฐ ํ™”๋ฉด ์ „ํ™˜ ์ด๋Ÿฐ๊ฒƒ ๋ฐ–์— ์•ˆ๋˜๋„ค

๋ณผํŠธ์ธ๊ฐ€ ๋ญ”๊ฐ€ ์•ˆ ์“ฐ๊ณ  ํ•˜๊ณ  ์‹ถ์€๋ฐ ํ˜น์‹œ ๊ฐ€๋Šฅํ• ๊นŒ??


using System.Collections;

using System.Collections.Generic;

using UnityEngine;


public class Summon : MonoBehaviour

{

ย  ย  public Transform[] summonPoints;

ย  ย  public GameObject[] diceObjects;

ย  ย  const int HOWMANYDICES = 5;

ย  ย  const int HOWMANYPOINTS = 3;

ย  ย  private int cnt;


ย  ย  public bool[] isSummon = new bool[HOWMANYPOINTS];


ย  ย  void SummonDice()

ย  ย  {

ย  ย  ย  ย  int randomDice = Random.Range(0, HOWMANYDICES + 1);

ย  ย  ย  ย  int randomPoint = Random.Range(0, HOWMANYPOINTS + 1);


ย  ย  ย  ย  if (cnt <= HOWMANYPOINTS + 1)

ย  ย  ย  ย  { }

ย  ย  ย  ย  else if (isSummon[randomPoint] == false)

ย  ย  ย  ย  {

ย  ย  ย  ย  ย  ย  Instantiate(diceObjects[randomDice], summonPoints[randomPoint].position, summonPoints[randomPoint].rotation);

ย  ย  ย  ย  ย  ย  isSummon[randomPoint] = true;

ย  ย  ย  ย  ย  ย  cnt++;

ย  ย  ย  ย  }

ย  ย  ย  ย  else

ย  ย  ย  ย  {

ย  ย  ย  ย  ย  ย  SummonDice();

ย  ย  ย  ย  }

ย  ย  }

}