Пример #1
0
    /// <summary>
    /// Use this for initialization
    /// </summary>
    void Start()
    {
        // start move timer
        moveTimer = gameObject.AddComponent <Timer>();
        moveTimer.AddTimerFinishedListener(HandleMoveTimerFinishedEvent);
        moveTimer.Duration = 1;
        moveTimer.Run();

        // start death timer
        deathTimer          = gameObject.AddComponent <Timer>();
        deathTimer.Duration = ConfigurationUtils.BallLifeSeconds;
        deathTimer.AddTimerFinishedListener(HandleDeathTimerFinishedEvent);
        deathTimer.Run();

        // speedup effect support
        speedupTimer = gameObject.AddComponent <Timer>();
        EventManager.AddSpeedupEffectListener(HandleSpeedupEffectActivatedEvent);
        speedupTimer.AddTimerFinishedListener(HandleSpeedUpTimerFinishedEvent);
        rb2d = GetComponent <Rigidbody2D>();

        ballsLeftEvent = new BallsLeftEvent();
        EventManager.AddBallsLeftEffectInvoker(this);

        deathballevent = new DeathBallEvent();
        EventManager.AddDeathBallEventInvoker(this);
    }