public static void AddSpeedupEffectInvoker(SpeedupEffectActivated inputEvent)
 {
     speedupEffectInvokers.Add(inputEvent);
     if (speedupEffectListener != null)
     {
         inputEvent.AddListener(speedupEffectListener);
     }
 }
Beispiel #2
0
    public PickupBlock()
    {
        freezerEffectActivated = new FreezerEffectActivated();
        speedupEffectActivated = new SpeedupEffectActivated();

        EventManager.AddFreezerEffectActivatedInvoker(this);
        EventManager.AddSpeedupEffectActivatedInvoker(this);
    }
Beispiel #3
0
    // Start is called before the first frame update
    override protected void Start()
    {
        //check the effect of this block
        effectThisBlock = GetComponent <Block>().Effect;

        //set the effects duration
        freezeEffectDuration  = ConfigurationUtils.FreezerEffectDuration;
        speedupEffectDuration = ConfigurationUtils.SpeedupEffectDuration;

        //Event handling
        freezerEffectActivated = new FreezerEffectActivated();
        speedupEffectActivated = new SpeedupEffectActivated();

        //add effect invoker if this block is a freezer/speedup
        if (effectThisBlock == PickupEffect.Freezer)
        {
            EventManager.AddFreezeInvoker(this);
        }
        else if (effectThisBlock == PickupEffect.Speedup)
        {
            EventManager.AddSpeedupInvoker(this);
        }

        // Define data based on component attached (speedup or freezer)
        // Not the best approach but it is used to minimize major changes

        if (GetComponent <Block_Speedup>() != null)
        {
            destroyPoints   = ConfigurationUtils.BlockSpeedupPoints;
            percentageSpawn = ConfigurationUtils.BlockSpeedupProbability;
            effect          = PickupEffect.Speedup;
        }
        else if (GetComponent <Block_Freezer>() != null)
        {
            destroyPoints   = ConfigurationUtils.BlockFreezerPoints;
            percentageSpawn = ConfigurationUtils.BlockFreezerProbability;
            effect          = PickupEffect.Freezer;
        }

        base.Start();
    }
    // Start is called before the first frame update
    override protected void Start()
    {
        effectSpeedup = ConfigurationUtils.EffectSpeedup;
        points        = ConfigurationUtils.PointsPickupBlock;

        switch (pickupEffect)
        {
        case PickupEffect.Freezer:
            durationEffect = ConfigurationUtils.DurationEffectFreezer;
            GetComponent <SpriteRenderer>().sprite = sprites[(int)pickupEffect];
            freezerEffectActivated = new FreezerEffectActivated();
            EventManager.AddInvokerFreezer(this);
            break;

        case PickupEffect.Speedup:
            durationEffect = ConfigurationUtils.DurationEffectSpeedup;
            GetComponent <SpriteRenderer>().sprite = sprites[(int)pickupEffect];
            speedupEffectActivated = new SpeedupEffectActivated();
            EventManager.AddInvokerSpeedup(this);
            break;
        }

        base.Start();
    }