mockup of utility functions
This commit is contained in:
@@ -22,6 +22,7 @@ using Tyra::DynamicMesh;
|
||||
using Tyra::DynPipOptions;
|
||||
using Tyra::Engine;
|
||||
using Tyra::Renderer;
|
||||
using Tyra::Renderer3DUtility;
|
||||
using Tyra::TextureRepository;
|
||||
using Tyra::Vec4;
|
||||
|
||||
@@ -53,6 +54,7 @@ class Enemy {
|
||||
bool isFighting = false;
|
||||
Vec4 spawnPoint;
|
||||
|
||||
Renderer3DUtility* utility;
|
||||
Audio* audio;
|
||||
EnemyInfo info;
|
||||
};
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace Demo {
|
||||
|
||||
Enemy::Enemy(Engine* engine, const EnemyInfo& t_info) {
|
||||
info = t_info;
|
||||
utility = &engine->renderer.renderer3D.utility;
|
||||
|
||||
mesh = new DynamicMesh(*info.motherMesh);
|
||||
|
||||
@@ -96,6 +97,10 @@ void Enemy::handlePlayerShoot(const PlayerShootAction& shootAction) {
|
||||
|
||||
auto isOnEnemy = ray.intersectBox(bbox.min(), bbox.max());
|
||||
|
||||
utility->drawBBox(bbox);
|
||||
utility->drawLine(ray.origin, ray.direction);
|
||||
utility->drawPoint(*mesh->getPosition());
|
||||
|
||||
if (isOnEnemy) {
|
||||
mesh->setPosition(spawnPoint);
|
||||
TYRA_LOG("Enemy hit!");
|
||||
|
||||
@@ -65,8 +65,8 @@ void GameState::update() {
|
||||
fpsChecker = 0;
|
||||
}
|
||||
|
||||
skybox->update(player->getPosition());
|
||||
player->update(terrain->heightmap);
|
||||
skybox->update(player->getPosition());
|
||||
auto shootAction = player->getShootAction();
|
||||
enemyManager->update(terrain->heightmap, player->getPosition(), shootAction);
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ PlayerShootAction Player::getShootAction() const {
|
||||
action.isShooting = weapon.isShooting;
|
||||
|
||||
if (action.isShooting) {
|
||||
action.ray = Ray(camera.position, camera.lookAt);
|
||||
action.ray = Ray(camera.position, camera.lookAt.getNormalized());
|
||||
}
|
||||
|
||||
return action;
|
||||
|
||||
Reference in New Issue
Block a user