Ejemplo n.º 1
0
    private void executeEffectBatch(VGDLEffect ef, VGDLSprite s1, List <VGDLSprite> s2list)
    {
        // There is a collision. Apply the effect.
        int batchCount = ef.executeBatch(s1, s2list, this);

        if (batchCount == -1)
        {
            Debug.Log("WARNING: Batch collision not or bad implemented (batchCount == -1)");
            batchCount = 0; //So the game keeps making better sense.
        }

        // Affect score:
        if (ef.applyScore)
        {
            // apply scores for all avatars
            for (int i = 0; i < no_players; i++)
            {
                var multScore = ef.getScoreChange(i) * batchCount;
                avatars[i].addScore(multScore);
            }
        }

        // Add to events history.
        if (s1 != null && s2list != null)
        {
            foreach (VGDLSprite s2 in s2list)
            {
                addEvent(s1, s2);
            }
        }

        if (ef.count)
        {
            for (int i = 0; i < no_counters; i++)
            {
                var multCounter = ef.getCounter(i) * batchCount;
                this.counters[i] += multCounter;
            }
        }

        if (ef.countElse)
        {
            for (int i = 0; i < no_counters; i++)
            {
                var multElseCounter = ef.getCounterElse(i) * batchCount;
                this.counters[i] += multElseCounter;
            }
        }
    }
Ejemplo n.º 2
0
    public void executeEffect(VGDLEffect ef, VGDLSprite s1, VGDLSprite s2)
    {
        // There is a collision. Apply the effect.
        ef.execute(s1, s2, this);

        // Affect score:
        if (ef.applyScore)
        {
            // apply scores for all avatars
            for (int i = 0; i < no_players; i++)
            {
                avatars[i].addScore(ef.getScoreChange(i));
            }
        }

        // Add to events history.
        if (s1 != null && s2 != null)
        {
            addEvent(s1, s2);
        }

        if (ef.count)
        {
            for (int i = 0; i < no_counters; i++)
            {
                counters[i] += ef.getCounter(i);
            }
        }

        if (ef.countElse)
        {
            for (int i = 0; i < no_counters; i++)
            {
                counters[i] += ef.getCounterElse(i);
            }
        }
    }