// Use this for initialization
    void Start()
    {
        mTTC      = GetComponent <moveTetrominoToCenter>();
        floor     = GameObject.Find("Floor").GetComponent <Floor>();
        tileArray = floor.getArrayOfTiles();
        neighborData.rotate();

        visualShape = Instantiate(shapeMap.Find(x => x.shape == shape).shapePrefab, this.transform).GetComponent <shapeController>();
    }
Beispiel #2
0
    void Update()
    {
        // Handles choosing of shapes in scene

        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, 100))
            {
                if (hit.transform.tag == "shape")
                {
                    for (int i = 0; i < shapes.Length; i++)
                    {
                        shapes[i].GetComponent <shapeController>().selected = false;
                    }

                    shapeController shapeHit = hit.transform.GetComponent <shapeController>();
                    shapeHit.selected = true;
                }
            }
        }

        // Handles button presses

        for (int i = 0; i < buttons.Length; i++)
        {
            if (buttons[i].GetComponent <buttonControl>().pressed == true)
            {
                buttons[i].GetComponent <Transform>().localScale = scale;
                finishCounter--;
            }
        }

        if (finishCounter <= 0 && finito == false)
        {
            Timing();
            finito = true;
            Debug.Log("Finished!");
        }
    }
 private void tetrominoReset()
 {
     visualShape             = Instantiate(shapeMap.Find(x => x.shape == shape).shapePrefab, this.transform).GetComponent <shapeController>();
     transform.localPosition = new Vector3(0f, -5f, 0f);
 }