Ejemplo n.º 1
0
    /// <summary>
    /// Use this for initialization
    /// </summary>
    void Start()
    {
        // save spawn boundaries for efficiency
        minSpawnX  = ScreenUtils.ScreenLeft;
        maxSpawnX  = ScreenUtils.ScreenRight;
        minSpawnY  = ScreenUtils.ScreenBottom;
        maxSpawnY  = ScreenUtils.ScreenTop;
        borderH    = (maxSpawnX - minSpawnX) / 6;
        borderV    = (maxSpawnY - minSpawnY) / 6;
        minSpawnX += borderH;
        maxSpawnX -= borderH;
        minSpawnY += borderV;
        maxSpawnY -= borderV;


        EventManager.AddBonusBarCompletedListener(SpawnBonusObject);
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        // Create and start timer
        gameTimer          = gameObject.AddComponent <Timer>();
        gameTimer.Duration = secondsForGame;
        gameTimer.Run();

        // Initialize timer text
        timeText      = GameObject.FindGameObjectWithTag("TimeText").GetComponent <Text>();
        timeText.text = TimePrefix + secondsForGame;

        // Initialize score text
        scoreText      = GameObject.FindGameObjectWithTag("ScoreText").GetComponent <Text>();
        scoreText.text = ScorePrefix + score;


        gameEnded = new GameEnded();
        EventManager.AddGameEndedInvoker(this);

        // Add listeners to the event manager
        EventManager.AddPointsChangedListener(ChangePoints);
        EventManager.AddBonusBarCompletedListener(ChangeTime);
    }