Esempio n. 1
0
 // Use this for initialization
 virtual protected void Start()
 {
     // add self as event invoker
     intUnityEvents.Add(EventName.PointsAdded, new PointsAddedEvent());
     IntEventManager.AddInvoker(EventName.PointsAdded, this);
     intUnityEvents.Add(EventName.BlockDestroyed, new BlockDestroyedEvent());
     IntEventManager.AddInvoker(EventName.BlockDestroyed, this);
 }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        scoreText          = GameObject.FindGameObjectWithTag("ScoreText").GetComponent <Text>();
        ballsLeftText      = GameObject.FindGameObjectWithTag("BallsLeftText").GetComponent <Text>();
        ballsLeft          = ConfigurationUtils.BallsPerGame;
        ballsLeftText.text = "Balls Left: " + ballsLeft.ToString();

        blockCount = LevelBuilder.BlockCount; // cheap 'n nasty; could also get this by finding tagged block count

        IntEventManager.AddListener(EventName.PointsAdded, AddPoints);
        IntEventManager.AddListener(EventName.SubtractBallsEvent, SubtractBalls);
        IntEventManager.AddListener(EventName.BlockDestroyed, SubtractBlocks);

        intUnityEvents.Add(EventName.GameOverEvent, new GameOverEvent());
        IntEventManager.AddInvoker(EventName.GameOverEvent, this);
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        rb = GetComponent <Rigidbody2D>();

        timerBallLifeTime          = gameObject.AddComponent <Timer>();
        timerBallLifeTime.Duration = ConfigurationUtils.BallLifeTime;
        timerBallLifeTime.Run();

        timerBallStart          = gameObject.AddComponent <Timer>();
        timerBallStart.Duration = 1;
        timerBallStart.Run();

        intUnityEvents.Add(EventName.SubtractBallsEvent, new SubtractBallsEvent());
        IntEventManager.AddInvoker(EventName.SubtractBallsEvent, this);
        intUnityEvents.Add(EventName.BallsDiedEvent, new BallsDiedEvent());
        IntEventManager.AddInvoker(EventName.BallsDiedEvent, this);
    }