Ejemplo n.º 1
0
    void Init()
    {
        int n = 0;

        for (int y = 3; y >= 0; y--)
        {
            for (int x = 0; x < 4; x++)
            {
                NumberBox box = Instantiate(boxPrefab, new Vector2(x, y), Quaternion.identity);
                box.Init(x, y, n + 1, sprites[n], ClickToSwap);
                boxes[x, y] = box;
                n++;
            }
        }
    }
Ejemplo n.º 2
0
    private NumberBox RegisterIcon(CCell pos)
    {
        NumberBox box = Instantiate(boxPrefab);

        //box.transform.SetParent(this.transform);
        box.transform.localScale = Vector3.one;

        //box.transform.SetParent(Canvas.transform, true);
        box.transform.position = GetIconCenterByCell(pos);
        int index = pos.y + kMaxY * pos.x;

        box.Init(pos.x, pos.y, index + 1, sprites[index], ClickToSwap, GameFinish);
        box.transform.SetParent(this.transform);
        //box.transform.SetParent(Canvas.transform, true);
        //box.transform.SetParent(GameObject.FindGameObjectWithTag("canvasa").transform, true);
        return(box);
    }
Ejemplo n.º 3
0
    void Init()
    {
        int n = 0;

        for (int y = 3; y >= 0; y--)
        {
            for (int x = 0; x < 4; x++)
            {
                Vector3   fk  = new Vector3(x, y, 0);
                NumberBox box = Instantiate(boxPrefab, fk + new Vector3(500, 500, 500), Quaternion.identity);
                //NumberBox box = Instantiate(boxPrefab,tPoZX , Quaternion.identity);
                box.Init(x, y, n + 1, sprites[n], ClickToSwap);
                boxes[x, y] = box;
                n++;
                //transform.position = new Vector3(Random.Range(-1f, 7f), Random.Range(3.3f, -4f));
                //tPoZX = new Vector2(Random.Range(-1f, 7f), Random.Range(3.3f, -4f));

                // Instantiate(boxPrefab, boxPrefab.position + (Vector3.up * 1.63f), boxPrefab.rotation * Quaternion.AngleAxis(30.0f, Vector3.up));
                // Instantiate(boxPrefab, new Vector2(x, y), Quaternion.identity);
            }
        }
    }