Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        // Set to spawn every 4 seconds
        _period = 5f;
        _decreaseAmount = 0.10f;		// Decrease by this many seconds (for time between spawns)
        _intervalPerDecrease = 30f;		// Second interval to up the difficulty (a.k.a. decrease the spawn rate by _decreaseAmont time)
        _nextIntervalDecreaseTime = 0f + _intervalPerDecrease;
        _minTimeBetweenSpawns = 1.5f;

        // Set spawn location
        transform.position = new Vector3(0f, 21.80f, 0f);

        // Grab reference of the tetromino queue
        GameObject go = GameObject.Find("TetrinoSelector");
        _tetrinoSelector = (TetrinoSelector) go.GetComponent(typeof(TetrinoSelector));

        // Grab reference of the tetromino spawn timer
        GameObject go2 = GameObject.Find("TetrinoSpawnTimer");
        _tetrinoSpawnTimer = (TetrinoSpawnTimer) go2.GetComponent(typeof(TetrinoSpawnTimer));
        _tetrinoSpawnTimer.SetTimer(0f, float.PositiveInfinity, 0f, _period);
        _tetrinoSpawnTimer.ShouldPop = true;
        _tetrinoSpawnTimer.BeginCountUp();

        // Grab reference of the tetromino spawn rate modifier (for adjusting difficulty on the spawn timer)
        GameObject go3 = GameObject.Find("TetrinoSpawnRateModifier");
        _tetrinoSpawnRateModifier = (TetrinoSpawnRateModifier) go3.GetComponent(typeof(TetrinoSpawnRateModifier));
        _tetrinoSpawnRateModifier.SetDecreaseAmount(_decreaseAmount);				// Decrease by _decreaseAmount seconds at a set interval
        _tetrinoSpawnRateModifier.SetIntervalPerDecrease(_intervalPerDecrease);		// Every _intervalPerDecrease seconds, decrease the interval by _decreaseAmount seconds

        // Get Classic mode state to check if game is over
        GameObject go4 = GameObject.Find("Main Camera");
        _classicModeState = (Classic)go4.GetComponent(typeof(Classic));

        // Get score manager reference
        GameObject go5 = GameObject.Find("ScoreManager");
        _scoreManager = (ScoreManager) go5.GetComponent(typeof(ScoreManager));
    }
Ejemplo n.º 2
0
 private void LoadTetrinoSelectorReference()
 {
     GameObject go = GameObject.Find("TetrinoSelector");
     _tetrinoSelector = (TetrinoSelector) go.GetComponent(typeof(TetrinoSelector));
 }