Exemplo n.º 1
0
    public static void RandomEffect(PowerupBehavior beh)
    {
        if (Consts == null)
        {
            Consts = WorldConstants.ConstantsOwner.GetComponent <CollectibleObjectiveConstants>();
        }

        const int numbEffects = 6;

        beh.EffectIndex = Random.Range(0, numbEffects);

        switch (beh.EffectIndex)
        {
        case 0:
            beh.Effect         = new PowerupIncreasesMultiplier(Consts.PowerupGiveMultiplierIncrement);
            beh.positiveEffect = true;
            break;

        case 1:
            beh.Effect         = new PowerupThrowsEnemies();
            beh.positiveEffect = false;
            break;

        case 2:
            beh.Effect         = new PowerupJumblesControls();
            beh.positiveEffect = false;
            break;

        case 3:
            beh.Effect         = new PowerupHidesWalls();
            beh.positiveEffect = false;
            break;

        case 4:
            beh.Effect         = new PowerupTeleportsEnemies();
            beh.positiveEffect = false;
            break;

        case 5:
            if (!WorldConstants.MatchData.GeneratedLevel.GenSettings.WrapY)
            {
                RandomEffect(beh);
            }
            else
            {
                beh.Effect         = new PowerupStopsCollision();
                beh.positiveEffect = true;
            }
            break;

        default: throw new System.InvalidOperationException("Invalid powerup effect index!");
        }
    }
Exemplo n.º 2
0
 void Start()
 {
     GetComponent <Animator>().CurrentAnimation = Animations.Ob_Powerup;
     Consts = WorldConstants.ConstantsOwner.GetComponent <CollectibleObjectiveConstants>();
 }