#import "NPC.h"

@implementation NPC

-(id) init {
    self = [super init];

    if (self) {
        bbox = (BoundingBox){
            (Vector3){-1.0f, -1.0f, -1.0f}, 
            (Vector3){2.0f, 2.0f, 2.0f}
        };

        pos = (Vector3){0.0f, 1.0f, 0.0f};

        texture = LoadTexture("resources/textures/star.png");
        printf("%s\n", "initted");
    }

    return self;
}

+(id) new {
    return [[NPC alloc] init];
}

-(void) draw: (Camera3D) c {
    DrawBillboard(c, texture, pos, 4.0f, WHITE);
}

-(BoundingBox) bbox {
    return bbox;
}

-(void) activate {
    DialogueBox *dbox = [DialogueBox newWithText: "Cock and ball torture, from wikipedia, the free encyclopedia,\nat wikipedia.org"];
    Animator *anim = [Animator new];
    [anim addNode: (Vector2){50.0f, 450.0f}];
    [anim addNode: (Vector2){20.0f, 300.0f}];
    [anim addNode: (Vector2){90.0f, 250.0f}];
    [anim addNode: (Vector2){20.0f, 220.0f}];
    [anim addNode: (Vector2){50.0f, 450.0f}];
    [anim setSubject: dbox];
    [anim setSpeed: 30];
    [anim setIncrement: 16.66];
    [self sendObject: dbox to: renderer];
    [self sendObject: anim to: renderer];
    
    //[dbox slideIn];
    //printf("%s\n", "activated");

    //[dbox slideIn];
}

-(void) setRenderer: (Renderer *) r {
    renderer = r;
    //printf("%s\n", "set renderer");
}

-(void) sendObject: (id) obj to: (Renderer *) receiver {
    [receiver addObject: obj];
    //printf("%s\n", "sent obj to renderer");
}

@end