Esempio n. 1
0
    /**
     * Creates the sprite observation of a given sprite.
     * @param sprite sprite to create the observation from.
     * @return the observation object.
     */
    private Observation createSpriteObservation(VGDLSprite sprite)
    {
        var         category = getSpriteCategory(sprite);
        Observation obs      = new Observation(sprite.getType(), sprite.spriteID, sprite.getPosition(), VGDLUtils.VGDLDirections.NIL.getDirection(), category);

        observations.Add(sprite.spriteID, obs);
        return(obs);
    }
Esempio n. 2
0
    public override void execute(VGDLSprite sprite1, VGDLSprite sprite2, VGDLGame game)
    {
        if (sprite1 == null)
        {
            throw new ArgumentException("1st sprite can't be EOS with shieldFrom interaction.");
        }

        game.addShield(sprite1.getType(), stype, ftype.GetHashCode());
    }
Esempio n. 3
0
    private void addEvent(VGDLSprite s1, VGDLSprite s2)
    {
        if (s1.is_avatar || s1.is_from_avatar)
        {
            historicEvents.Add(
                new RecordedEvent(gameTick, s1.is_from_avatar,
                                  s1.getType(), s2.getType(),
                                  s1.spriteID, s2.spriteID, s1.getPosition()));
        }

        else if (s2.is_avatar || s2.is_from_avatar)
        {
            historicEvents.Add(
                new RecordedEvent(gameTick, s2.is_from_avatar,
                                  s2.getType(), s1.getType(),
                                  s2.spriteID, s1.spriteID, s2.getPosition()));
        }
    }
Esempio n. 4
0
    public override void execute(VGDLSprite sprite1, VGDLSprite sprite2, VGDLGame game)
    {
        if (sprite1 == null)
        {
            throw new ArgumentException("1st sprite can't be EOS with cloneSprite interaction.");
        }

        var type = sprite1.getType();
        var pos  = sprite1.getPosition();

        game.addSprite(type, pos);
    }
Esempio n. 5
0
    public override void execute(VGDLSprite sprite1, VGDLSprite sprite2, VGDLGame game)
    {
        var subtypes = game.getSubTypes(spawnPoint);

        foreach (var subtype in subtypes)
        {
            var sprites = game.getSprites(subtype);
            foreach (var sprite in sprites)
            {
                //NOTE: there's probably a more elegant way of handling this. Such as the below.
                //if(!(sprite is SpawnPoint)) continue;

                try {
                    var s = (SpawnPoint)sprite;
                    s.updateStype(sprite2.getType(), stype);
                } catch (Exception e) {
                    Debug.LogException(e);
                }
            }
        }
    }