#include "entity.h" #include "game.h" // TODO: Entity creation system Entity createEntity(EntityId id, Vector3 position) { Entity entity; entity.id = id; switch (id) { case OLD_MINT: case STICKY_NICKEL: entity.box = (BoundingBox){ .min = (Vector3){-0.4, -0.4, -0.4}, .max = (Vector3){0.4, 0.4, 0.4} }; break; case TREE: { Vector2 size = (Vector2){225.0 / 500.0 * TREE_SCALE, TREE_SCALE}; size = Vector2Scale(size, 0.5); entity.box = (BoundingBox){ .min = (Vector3){-size.x, -size.y, -size.x}, .max = (Vector3){size.x, size.y, size.x} }; } break; default: break; } setEntityPosition(&entity, position); return entity; } void updateEntity(Entity* entity, Game* game) { switch (entity->id) { case OLD_MINT: DrawBillboard(game->player.camera, game->assets.textures[MINT_TEXTURE], entity->position, 1.0, WHITE); break; case STICKY_NICKEL: DrawBillboard(game->player.camera, game->assets.textures[NICKEL_TEXTURE], entity->position, 1.0, WHITE); break; case TREE: DrawBillboard(game->player.camera, game->assets.textures[TREE_TEXTURE], entity->position, TREE_SCALE, WHITE); break; default: break; } } void setEntityPosition(Entity* entity, Vector3 position) { entity->position = position; entity->box.min = Vector3Add(entity->box.min, position); entity->box.max = Vector3Add(entity->box.max, position); }