Пример #1
0
 //
 //껏다켯다.
 public void BlinkTile()
 {
     if (GameObject.Find(transform.name) && (step % cycle) + 1 > (cycle - notstep))
     {
         ft.GetTile(tileNum).SetActive(false);
     }
     else if ((step % cycle) <= (cycle - notstep))
     {
         ft.GetTile(tileNum).SetActive(true);
     }
     step++;
 }
Пример #2
0
    void TrigerOn(int i)
    {
        //if문이 아니라면
        if (((play_vector[i].tag != "IfTailButton") && (play_vector[i].tag != "IfHeadButton")) || isIfmoon)
        {
            if (!(play_vector[i].tag == "IfTailButton"))
            {
                flow.transform.position = play_vector[i].transform.position;
            }

            //Debug.Log(play_vector[i].tag + "발동");
            //특수 타일 실행
            for (int j = 0; j < move.Blinkingobject.Count; j++)
            {
                string tileName = move.Blinkingobject[j].name;
                int    tileNum  = Convert.ToInt32(tileName.Substring(4));
                if (!(play_vector[i].tag == "IfTailButton") || !(play_vector[i].tag == "IfHeadButton"))
                {
                    ft.GetTile(tileNum).GetComponent <BlinkingObstacle>().BlinkTile();
                }
            }

            //움직이는 타일 실행
            for (int j = 0; j < move.Movingobject.Count; j++)
            {
                string tileName = move.Movingobject[j].name;
                int    tileNum  = Convert.ToInt32(tileName.Substring(4));
                if (!(play_vector[i].tag == "IfTailButton") || !(play_vector[i].tag == "IfHeadButton"))
                {
                    if (i % 2 == 0)
                    {
                        ft.GetTile(tileNum).GetComponent <MovingObstacle>().MoveTile();
                    }
                }
            }
        }
    }
Пример #3
0
    public void SetMoveTile()
    {
        for (int i = 0; i < move.tileCount; i++)
        {
            if (y > move.tileCount / 2)
            {
                if (y - i < 0)
                {
                    break;
                }
                nextNum = tileNum - i;
                if (ft.GetTile(nextNum).GetComponent <Renderer>().material.color == Color.black)
                {
                    MoveLine.Add(ft.GetTile(nextNum));
                }
            }
            else
            {
                if (y + i > move.tileCount - 1)
                {
                    break;
                }
                nextNum = tileNum + i;
                if (ft.GetTile(nextNum).GetComponent <Renderer>().material.color == Color.black)
                {
                    MoveLine.Add(ft.GetTile(nextNum));
                }
            }
        }

        start = Convert.ToInt32(MoveLine[0].name.Substring(4));
        end   = Convert.ToInt32(MoveLine[MoveLine.Count - 1].name.Substring(4));

        //Debug.Log(start + "~" + end);
        Num = start;
    }
Пример #4
0
    // Use this for initialization
    void Start()
    {
        //tilecount 구하기
        for (int i = 1; i <= 7; i++)
        {
            if (!GameObject.Find("Tile" + i))
            {
                tileCount = i - 1;
                break;
            }
        }

        //tileCount * tileCount 타일벡터생성
        for (int i = 0; i < tileCount; i++)
        {
            tile.Add(new GameObject[tileCount]);
            for (int j = 0; j < tileCount; j++)
            {
                if (GameObject.Find("Tile" + (i * 7 + j + 1)))
                {
                    tile[i][j] = GameObject.Find("Tile" + (i * 7 + j + 1));

                    //색깔 추출
                    if (!color_list.Contains(tile[i][j].GetComponent <Renderer>().material.color))
                    {
                        color_list.Add(tile[i][j].GetComponent <Renderer>().material.color);
                    }

                    //장애물 추출
                    if (tile[i][j].tag == "BlinkingObstacle")
                    {
                        Blinkingobject.Add(tile[i][j]);
                    }

                    if (tile[i][j].tag == "MovingObstacle")
                    {
                        Movingobject.Add(tile[i][j]);
                    }

                    if (tile[i][j].tag == "Obstacle")
                    {
                        tile[i][j].SetActive(false);
                    }
                }
            }
        }

        //Guide Stage면 시작위치 변경
        switch (stagename)
        {
        case "GuideStage1":
            targetX  = 0;
            targetY  = 1;
            rotation = 2;
            break;

        case "GuideStage2":
            targetX  = 0;
            targetY  = 3;
            rotation = 2;
            break;

        case "GuideStage4":
            targetX  = 0;
            targetY  = 3;
            rotation = 2;
            break;

        default:
            targetX  = 0;
            targetY  = 0;
            rotation = 0;
            break;
        }

        //아이템 위치 기억
        items     = GameObject.FindGameObjectsWithTag("Item");
        itemCount = items.Length;
        init      = items.Length;
        for (int j = 0; j < items.Length; j++)
        {
            itemPos[j] = items[j].transform.localPosition;
        }

        for (int j = 0; j < Movingobject.Count; j++)
        {
            string tileName = Movingobject[j].name;
            int    tileNum  = Convert.ToInt32(tileName.Substring(4));
            ft.GetTile(tileNum).GetComponent <MovingObstacle>().SetMoveTile();
            ft.GetTile(tileNum).GetComponent <MovingObstacle>().InitTile2();
        }
    }