Beispiel #1
0
    /// <summary>
    /// Use this for initialization
    /// </summary>
    void Start()
    {
        // start move timer
        moveTimer          = gameObject.AddComponent <Timer>();
        moveTimer.Duration = 1;
        moveTimer.AddTimerFinishedListener(HandleMoveTimerFinished);
        moveTimer.Run();

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

        // ball death support
        ballDied = new BallDied();
        EventManager.AddBallDiedInvoker(this);

        // lost ball support
        ballLost = new BallLost();
        EventManager.AddBallLostInvoker(this);

        // speedup effect support
        speedupTimer = gameObject.AddComponent <Timer>();
        speedupTimer.AddTimerFinishedListener(HandleSpeedupTimerFinished);
        EventManager.AddSpeedupEffectListener(HandleSpeedupEffectActivatedEvent);
        rb2d = GetComponent <Rigidbody2D>();
    }
Beispiel #2
0
    /// <summary>
    /// Use this for initialization
    /// </summary>
    public virtual void Start()
    {
        // set number of points and hits the ball is worth
        if (ballType == BallType.Standard)
        {
            points = ConfigurationUtils.StandardPoints;
            hits   = ConfigurationUtils.StandardHits;
        }
        else if (ballType == BallType.Bonus)
        {
            points = ConfigurationUtils.BonusPoints;
            hits   = ConfigurationUtils.BonusHits;
        }

        // start move timer
        moveTimer          = gameObject.AddComponent <Timer>();
        moveTimer.Duration = 1;
        moveTimer.Run();
        moveTimer.AddTimerFinishedListener(HandleMoveTimerFinished);

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

        // save for efficiency
        rb2d = GetComponent <Rigidbody2D>();

        // add as invoker of various events
        EventManager.AddBallLostInvoker(this);
        EventManager.AddBallDiedInvoker(this);
    }
Beispiel #3
0
	/// <summary>
	/// Use this for initialization
	/// </summary>
	void Start()
	{
        // start move timer
        moveTimer = gameObject.AddComponent<Timer>();
        moveTimer.AddTimerFinishedListener(HandleMoveTimerFInished);
        moveTimer.Duration = 1;
        moveTimer.Run();

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


        // work with speed up timer
        speedUpTimer = gameObject.AddComponent<Timer>();
        speedUpTimer.AddTimerFinishedListener(HandleSpeedUpTimerFinished);
        EventManager.AddSpeedUpEffectListener(HandleSpeedUpEffectActivated);

        rigidbody2D = gameObject.GetComponent<Rigidbody2D>();


        ballDied = new BallDied();
        ballLost = new BallLost();
        EventManager.AddBallDiedInvoker(this);
        EventManager.AddBallLostInvoker(this);

    }