Exemple #1
0
    private void SpawnTetra()
    {
        GameObject nextInQueue = this.GetComponent <GrabBag>().GetFromQueue();

        //use temp object so that ghost instance doesn't also get the tetracube script
        GameObject temp = Instantiate(nextInQueue, Vector3.up * stageHeight, Quaternion.identity);

        temp.transform.parent = this.transform;
        temp.AddComponent <Tetracube>();
        activeTetra        = temp.GetComponent <Tetracube>();
        activeTetra.prefab = nextInQueue;
        activeTetra.stage  = this.GetComponent <Stage>();
    }
Exemple #2
0
    public void Place(Tetracube tetra)
    {
        tetra.transform.parent = cubeStack.transform;

        foreach (Transform cube in tetra.GetComponent <Tetracube>().cubes)
        {
            //	cube.transform.parent = cubeStack.transform;

            cube.GetComponentInChildren <Renderer>().enabled        = true;
            cube.GetComponentInChildren <Collider>().enabled        = true;
            cube.GetComponentInChildren <Collider>().gameObject.tag = "Cube";

            cube.name = "Voxel " + cube.transform.position;
            //	cubeStack.cubeStack.Add(cube.transform.position);
        }

        Destroy(activeTetra.ghost.gameObject);
        Destroy(activeTetra.facade.gameObject);
        Destroy(activeTetra.GetComponent <Tetracube>());

        cubeStack.CheckRows();
    }