예제 #1
0
    // Start is called before the first frame update
    void Start()
    {
        freezerEffectActivated = new FreezerEffectActivated();
        freezerEffectDuration  = ConfigurationUtils.FreezerDurationSeconds;

        speedUpEffectActivated = new SpeedUpEffectActivated();
        speedUpDuration        = 6;
        speedUpForse           = 20;

        bonusCoins = ConfigurationUtils.PointsForPickupBlock;
        SpriteRenderer spriteRenderer = gameObject.GetComponent <SpriteRenderer>();

        switch (pickupEffect)
        {
        case PickupEffect.Freezer:
            spriteRenderer.sprite = freezBlock;
            EventsManager.AddInvoker(this);
            break;

        case PickupEffect.Speedup:
            spriteRenderer.sprite = speedUpBlock;
            EventsManager.AddInvokerTwo(this);
            break;
        }
    }
예제 #2
0
 public static void AddFreezerEffectInvoker(FreezerEffectActivated inputEvent)
 {
     freezerEffectInvokers.Add(inputEvent);
     if (freezerEffectListener != null)
     {
         inputEvent.AddListener(freezerEffectListener);
     }
 }
예제 #3
0
    public PickupBlock()
    {
        freezerEffectActivated = new FreezerEffectActivated();
        speedupEffectActivated = new SpeedupEffectActivated();

        EventManager.AddFreezerEffectActivatedInvoker(this);
        EventManager.AddSpeedupEffectActivatedInvoker(this);
    }
예제 #4
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();
    }
예제 #5
0
    // 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();
    }