Ejemplo n.º 1
0
    public void init()
    {
        goFalse.SetActive(false);
        activeFalse.SetActive(false);
        theMiniGame = FindObjectOfType <MiniGameOnOff>();
        theStat     = FindObjectOfType <PlayerStatManager>();
        theNotice   = FindObjectOfType <NoticeManager>();
        theMini     = FindObjectOfType <MiniGameOnOff>();
        theReport   = FindObjectOfType <StockReportManager>();

        /*그림 및 글 초기화*/
        resultItemT.text = "두구두구";
        Sprite newSprite = Resources.Load <Sprite>("mystery") as Sprite;

        resultImage.GetComponent <Image>().sprite = newSprite;

        //랜덤으로 나올 상품들
        result = new List <string>();
        string[] randomString = new string[8] {
            "하트", "꽝", "본전X5", "꽝", "본전X2", "하트", "꽝", "다시하기"
        };

        for (int i = 0; i < ItemCnt; i++)
        {
            /*리스트에 0~7의 숫자를 넣는다*/
            StartList.Add(i);
        }

        for (int i = 0; i < ItemCnt; i++)
        {
            /*랜덤 인덱스에 0~7의 숫자를 배정*/
            int randomIndex = Random.Range(0, StartList.Count);
            /*결과리스트에 스타트 리스트에 있는 숫자중 랜덤 인덱스의 위치에 있는 값을 넣는다*/
            ResultIndexList.Add(StartList[randomIndex]);
            /*보여줄 아이템슬롯 0~7번에 랜점으로 배정된 이미지를 넣는다*/
            displayItemSolt[i].sprite = itemImage[StartList[randomIndex]];
            result.Add(randomString[StartList[randomIndex]]);
            /*이미 넣은 인덱스는 제거한다, count => 8, 7, 6, ...*/
            StartList.RemoveAt(randomIndex);
        }
    }