Search in sources :

Example 1 with Material

use of nars.rover.Material in project narchy by automenta.

the class AbstractPolygonBot method eat.

public void eat(Body eaten) {
    Material m = (Material) eaten.getUserData();
    if (m instanceof Sim.FoodMaterial) {
        nar.input("<goal --> [food]>. :|: %0.90;0.90%");
        nar.input("<goal --> [health]>. :|: %0.90;0.90%");
    } else if (m instanceof Sim.PoisonMaterial) {
        nar.input("<goal --> [food]>. :|: %0.00;0.90%");
        nar.input("<goal --> [health]>. :|: %0.00;0.90%");
    } else {
        return;
    }
    @Deprecated int sz = 48;
    float x = (float) Math.random() * sz - sz / 2f;
    float y = (float) Math.random() * sz - sz / 2f;
    // random new position
    eaten.setTransform(new Vec2(x * 2.0f, y * 2.0f), eaten.getAngle());
}
Also used : Sim(nars.rover.Sim) Vec2(spacegraph.space2d.phys.common.Vec2) Material(nars.rover.Material)

Aggregations

Material (nars.rover.Material)1 Sim (nars.rover.Sim)1 Vec2 (spacegraph.space2d.phys.common.Vec2)1