Exemple #1
0
    public static void setPuyoImage(Puyo puyo, string imgKey)
    {
        Image puyoImage = puyo.getPuyoObj().GetComponent <Image>();

        switch (puyo.getColor())
        {
        case 0:
            puyoImage.sprite = bluePuyoImgDic[imgKey];
            break;

        case 1:
            puyoImage.sprite = greenPuyoImgDic[imgKey];
            break;

        case 2:
            puyoImage.sprite = purplePuyoImgDic[imgKey];
            break;

        case 3:
            puyoImage.sprite = redPuyoImgDic[imgKey];
            break;

        case 4:
            puyoImage.sprite = yellowPuyoImgDic[imgKey];
            break;
        }
    }
    public Puyo PuyoCreate(int x, int y)
    {
        //print("puyo is creating...");
        Puyo puyo = player.puyoGroupObj.AddComponent <Puyo>();

        puyo.setColor(Random.Range(0, 3));
        puyo.setLinkStatus(ImageController.NORMAL);
        GameObject newPuyoObj;

        switch (puyo.getColor())
        {
        case 0:
            newPuyoObj = Instantiate(bluePuyoGameObject);
            break;

        case 1:
            newPuyoObj = Instantiate(greenPuyoGameObject);
            break;

        case 2:
            newPuyoObj = Instantiate(purplePuyoGameObject);
            break;

        case 3:
            newPuyoObj = Instantiate(redPuyoGameObject);
            break;

        case 4:
            newPuyoObj = Instantiate(yellowPuyoGameObject);
            break;

        default:
            newPuyoObj = Instantiate(bluePuyoGameObject);
            break;
        }
        newPuyoObj.transform.SetParent(player.puyoGroupObj.transform);
        newPuyoObj.transform.localPosition = new Vector3(x, y, 0);
        newPuyoObj.transform.localScale    = new Vector3(1, 1, 1);
        puyo.setPuyoObj(newPuyoObj);

        List <Puyo> puyoList = new List <Puyo>();

        puyoList.Add(puyo);
        puyo.setLinkPuyoList(puyoList);

        return(puyo);
    }