aboutsummaryrefslogtreecommitdiff
path: root/src/entities/generale.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/entities/generale.c')
-rw-r--r--src/entities/generale.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/entities/generale.c b/src/entities/generale.c
index 017f213..4865d4e 100644
--- a/src/entities/generale.c
+++ b/src/entities/generale.c
@@ -4,17 +4,51 @@
void initGenerale(Entity * entity, Game * game) {
entity->model = &game->assets.models[GENERALE_ASSET];
+ entity->collisionModel = entityCreateCollisionModel(*entity->model);
+ entity->transformedCollisionModel = entityCreateCollisionModel(*entity->model);
setEntityRadius(entity);
- entity->velocity.angularVelocity = (AxisAngle){(Vector3){1.0, 1.0, 1.0}, 1.0};
+
+ // Allocate data.
+ entity->data = KF_MALLOC(sizeof(Generale));
+
+ if (entity->data == NULL) {
+ ALLOCATION_ERROR;
+ return;
+ }
+
+ Generale * data = (Generale*)entity->data;
+
+ data->flyToPoint = (EntityFlyToPointInfo){
+ .controller.bangbang.speed = 85.0,
+ .controller.bangbang.stopAt = 0.0,
+ .controlType = ENTITY_FLY_TO_POINT_BANG_BANG,
+ .rotationSpeed = 0.0,
+ .applyRotation = false
+ };
+
+ data->zigzag = GENERALE_ZIG;
}
void closeGenerale(Entity * entity) {
+ if (entity->data != NULL)
+ KF_FREE(entity->data);
+
+ entityFreeCollisionModel(entity->collisionModel);
+ entityFreeCollisionModel(entity->transformedCollisionModel);
}
void updateGenerale(Game * game, Entity * entity) {
- entityUpdateRotation(entity);
+ entityUpdateLastValues(entity);
+
+ entityCheckTransformedCollisionModel(entity);
}
void drawGenerale(Game * game, Entity * entity) {
entityDraw(entity);
}
+
+void getTargetGenerale(Game * game, Entity * entity) {
+ Entity * player = getEntityFromWorld(game->world, 0);
+
+ Vector3 dis = Vector3Subtract(
+}