protected override void Start()
    {
        base.Start();

        scoreWorth = ConfigurationUtils.BlockValuePickup;
        var tempRend = GetComponent <SpriteRenderer>();

        tempRend.sprite = _sprites[(int)effect];

        // Event stuff
        _eventInvoker = new FloatEventInvoker();

        switch (effect)
        {
        case PickupEffect.Freezer:
            _effectDuration = ConfigurationUtils.PickupFreezerDuration;
            _eventInvoker.AddSupportedEvent(EventName.FreezerEvent);
            break;

        case PickupEffect.Speedup:
            _effectDuration = ConfigurationUtils.PickupSpeederDuration;
            _eventInvoker.AddSupportedEvent(EventName.SpeederEvent);
            break;
        }
    }
Beispiel #2
0
    private void Start()
    {
        // Score Stuff
        _score     = 0;
        _scoreText = GameObject.FindWithTag("ScoreText").GetComponent <Text>();
        if (_scoreText == null)         // Just in case
        {
            Debug.Log("Score Text not Found!");
        }
        // Score Event Listener
        EventManager.AddListener(EventName.AddPointsEvent, HandleEvent_AddScore);

        // Balls Left Stuff
        _ballsLeft     = ConfigurationUtils.BallsPerGame;
        _ballsLeftText = GameObject.FindWithTag("BallsLeftText").GetComponent <Text>();
        if (_ballsLeftText == null)         // Just in case
        {
            Debug.Log("Balls Left Text not Found!");
        }
        // Balls Left Event Listener
        EventManager.AddListener(EventName.RemoveBallEvent, HandleEvent_RemoveBall);

        // Lost Ball Event Invoker
        _eventInvoker = new FloatEventInvoker();
        _eventInvoker.AddSupportedEvent(EventName.LastBallLostEvent);


        // Game Over stuff
        _gameOverText.text = "";
        _isGameOver        = false;

        // Refreshing UI
        RefreshUIText();
    }
Beispiel #3
0
 /// <summary>
 /// Adds the given invoker for the given event name
 /// </summary>
 /// <param name="eventName">Event name.</param>
 /// <param name="invoker">Invoker.</param>
 public static void AddInvoker(EventName eventName, FloatEventInvoker invoker)
 {
     foreach (UnityAction <float> listener in listeners[eventName])
     {
         invoker.AddListener(eventName, listener);
     }
     invokers[eventName].Add(invoker);
 }
 public static void AddInvoker(EventName eventName, FloatEventInvoker invoker)
 {
     // Add listeners to new Invoker
     foreach (UnityAction <float> listener in listeners[eventName])
     {
         invoker.AddListener(eventName, listener);
     }
     // Add Invoker to a list in dictionary of invokers
     invokers[eventName].Add(invoker);
 }
Beispiel #5
0
    // Start is called before the first frame update
    void Start()
    {
        // Getting Components
        _localRigid = GetComponent <Rigidbody2D>();

        // Setting States
        _isLaunched = false;
        _isAlive    = true;
        SetupTimers();

        // Freeze Ball
        _waitTimer.Run();
        _localRigid.isKinematic = true;

        // Event Stuff
        _eventInvoker = new FloatEventInvoker();
        // RemoveBall
        // Ball Dies
        _eventInvoker.AddSupportedEvent(EventName.RemoveBallEvent);
        _eventInvoker.AddSupportedEvent(EventName.BallDiesEvent);
    }
Beispiel #6
0
 protected virtual void Start()
 {
     // Advanced Event Invoker
     _floatEventInvoker = new FloatEventInvoker();
     _floatEventInvoker.AddSupportedEvent(EventName.AddPointsEvent);
 }
Beispiel #7
0
 /// <summary>
 /// Removes the given invoker for the given eventy name
 /// </summary>
 /// <param name="eventName">Event name.</param>
 /// <param name="invoker">Invoker.</param>
 public static void RemoveInvoker(EventName eventName, FloatEventInvoker invoker)
 {
     // remove invoker from dictionary
     invokers[eventName].Remove(invoker);
 }