npc
parent
8a0f249cc1
commit
4f7e0a31b0
@ -0,0 +1,27 @@
|
||||
//just going to be a simple npc the player can activate
|
||||
//and it displays a text box
|
||||
|
||||
#ifndef NPC_H
|
||||
#define NPC_H
|
||||
|
||||
#import <raylib.h>
|
||||
#import <yeslib.h>
|
||||
#import <stdio.h>
|
||||
#import "Activator.h"
|
||||
|
||||
@interface NPC : YSObject <Receiver> {
|
||||
BoundingBox bbox;
|
||||
Vector3 pos;
|
||||
Texture2D texture;
|
||||
}
|
||||
|
||||
-(id) init;
|
||||
+(id) new;
|
||||
-(void) draw: (Camera3D) camera;
|
||||
-(void) activate;
|
||||
|
||||
-(BoundingBox) bbox;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
@ -0,0 +1,39 @@
|
||||
#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 {
|
||||
printf("%s\n", "wow i did it");
|
||||
}
|
||||
|
||||
@end
|
||||
Loading…
Reference in New Issue