コード例 #1
0
ファイル: Spawner.cs プロジェクト: ProvencalG/Tetris
    // To invoke in GameController: Gets the random shape, by its position in the array, and call its spawning
    public Shape SpawnRandomShape()
    {
        Shape shape = null;

        shape = GetQueuedShape();
        shape.transform.position   = transform.position;
        shape.transform.localScale = Vector3.one;

        //StartCoroutine(GrowShape(shape, transform.position, 2f));

        if (m_spawnFX)
        {
            m_spawnFX.Play();
        }

        if (shape)
        {
            return(shape);
        }
        else
        {
            Debug.Log($"<color=red><b>ERROR!</b> Invalid shape in spawner!</color>");
            return(null);
        }
    }
コード例 #2
0
ファイル: GameController.cs プロジェクト: ProvencalG/Tetris
    IEnumerator GameOverRoutine()
    {
        if (m_gameOverFx)
        {
            m_gameOverFx.Play();
        }
        yield return(new WaitForSeconds(0.3f));

        m_gameOverPanel.SetActive(true);
    }
コード例 #3
0
    void LevelUp()
    {
        m_level++;
        m_lines     += (m_linesPerLevel * m_level);
        m_didLevelUp = true;

        if (m_levelUpFx)
        {
            m_levelUpFx.Play();
        }
    }
コード例 #4
0
ファイル: Shape.cs プロジェクト: ProvencalG/Tetris
    public void SnapShapeFX()
    {
        int i = 0;

        foreach (Transform child in gameObject.transform)
        {
            if (m_snapShapeFX[i])
            {
                m_snapShapeFX[i].transform.position = child.position;

                ParticleTrigger particleTrigger = m_snapShapeFX[i].GetComponent <ParticleTrigger>();
                if (particleTrigger)
                {
                    particleTrigger.Play();
                }
                i++;
            }
        }
    }