Exemple #1
0
    // Use this for initialization
    void Start()
    {
        m_board           = FindObjectOfType <Board>();
        m_spawner         = FindObjectOfType <Spawner>();
        m_scoreManager    = FindObjectOfType <ScoreManager>();
        m_soundManager    = FindObjectOfType <SoundManager>();
        m_ghostController = FindObjectOfType <GhostController>();

        if (!m_board)
        {
            Debug.LogError("Board not found");
        }
        if (!m_spawner)
        {
            Debug.LogError("Spawner not found");
        }
        if (!m_scoreManager)
        {
            Debug.LogError("ScoreManager not found");
        }
        if (!m_soundManager)
        {
            Debug.LogError("SoundManager not found");
        }

        m_activeShape = m_spawner.SpawnShape() as Shape;
        m_ghostController.Create(m_activeShape);

        if (!m_activeShape)
        {
            Debug.LogError("Failed to Spawn ActiveShape");
        }

        //a.x = 0;
        //Debug.LogError("a: " + a.x);
        //Application.targetFrameRate = 120;
        //QualitySettings.vSyncCount = 0;
        Debug.Log("TargetFrameRate: " + Application.targetFrameRate);
    }
Exemple #2
0
    void LandShape()
    {
        m_board.StoreShape(m_activeShape);

        int rowsClears = 0;

        rowsClears = m_board.CheckRow();
        if (rowsClears > 0)
        {
            m_soundManager.PlayRowClearVocal();
        }

        m_scoreManager.UpdateScore(rowsClears);

        if (m_board.IsAboveTop(m_activeShape))
        {
            m_soundManager.PlayGameOverSound();
            m_endGame = true;
        }
        m_activeShape = m_spawner.SpawnShape();
        m_ghostController.Reset();
        m_ghostController.Create(m_activeShape);
        m_soundManager.PlayLandShapeSound();
    }