public GDKnyttBaseObject getNode(GDKnyttObjectLayer layer, KnyttPoint coords)
    {
        var node = scene.Instance() as GDKnyttBaseObject;

        node.initialize(object_id, layer, coords);
        return(node);
    }
Example #2
0
 public void initialize(KnyttPoint object_id, GDKnyttObjectLayer layer, KnyttPoint coords)
 {
     SetPhysicsProcess(false);
     this.Layer    = layer;
     this.ObjectID = object_id;
     this.Coords   = coords;
     this._Initialize();
 }
Example #3
0
    private void turnOffObjects(GDKnyttObjectLayer layer)
    {
        foreach (Node obj in layer.GetChildren())
        {
            foreach (Node child in obj.GetChildren())
            {
                switch (child)
                {
                case CollisionShape2D shape: shape.SetDeferred("disabled", true); break;

                case CollisionPolygon2D polygon: polygon.SetDeferred("disabled", true); break;

                case Area2D area: area.CollisionLayer = 0; area.CollisionMask = 0; break;

                case PhysicsBody2D body: body.CollisionLayer = 0; body.CollisionMask = 0; break;
                }
            }
        }
    }