private void Start()
    {
        // is geloof ik beter voor performance dan telkens iets.instance te gebruiken
        //audioManager = AudioManager.Instance;
        audioManager = V3AudioManager.Instance;
        controller   = V3Controller.Instance;
        blockManager = V3BlockManager.Instance;

        // stel het grid en de bounds in
        gridWidth  = controller.gridWidth;
        gridHeight = controller.gridHeight;

        grid = new Transform[gridWidth, gridHeight];
        UpdateOrigins(gridWidth, gridHeight);
        SetLineRendererPositions();

        // voeg minos toe aan pool
        blockManager.AddNMinos(gridWidth * gridHeight);

        // was eerst globaal, maar dat is nu niet meer nodig, omdat de tetromino naar zijn startpositie kan springen
        Vector3 tetrominoSpawnPosition = new Vector3(bounds.topLeft.x + (bounds.topRight.x - bounds.topLeft.x) / 2, bounds.topLeft.y, bounds.topLeft.z);

        // maak tetromino aan
        tetromino        = Instantiate(tetrominoPrefab, tetrominoSpawnPosition, Quaternion.identity).GetComponent <V3Tetromino>();
        tetromino.player = this;

        otherPlayer = controller.player1 == this ? controller.player2 : controller.player1;
        controller.SpawnBall(this);

        verMoveSpeed = verMoveStartSpeed;
    }
Exemple #2
0
 private void Start()
 {
     blockManager = V3BlockManager.Instance;
     SetStartPosition(transform.position);
     GetNewShape();
 }