add basic shoot on enemy

This commit is contained in:
h4570
2022-08-14 20:48:10 +02:00
parent 37257b253a
commit 26596fa2c3
6 changed files with 39 additions and 13 deletions
+5 -1
View File
@@ -13,6 +13,7 @@
#include <tyra>
#include "states/game/renderer/renderer_dynamic_pair.hpp"
#include "states/game/terrain/heightmap.hpp"
#include "states/game/player/player_shoot_action.hpp"
#include "./enemy_info.hpp"
using Tyra::AnimationSequenceCallback;
@@ -35,7 +36,8 @@ class Enemy {
DynPipOptions* options;
RendererDynamicPair* pair;
void update(const Heightmap& heightmap, const Vec4& playerPosition);
void update(const Heightmap& heightmap, const Vec4& playerPosition,
const PlayerShootAction& shootAction);
private:
std::vector<u32> walkSequence;
@@ -45,9 +47,11 @@ class Enemy {
void walk(const Heightmap& heightmap, const Vec4& positionDiff);
void animationCallback(const AnimationSequenceCallback& callback);
void fight();
void handlePlayerShoot(const PlayerShootAction& shootAction);
bool isWalking = true;
bool isFighting = false;
Vec4 spawnPoint;
Audio* audio;
EnemyInfo info;
+3 -1
View File
@@ -13,6 +13,7 @@
#include <tyra>
#include <vector>
#include "states/game/terrain/heightmap.hpp"
#include "states/game/player/player_shoot_action.hpp"
#include "./enemy.hpp"
using Tyra::DynamicMesh;
@@ -28,7 +29,8 @@ class EnemyManager {
EnemyManager(Engine* engine, const Heightmap& heightmap);
~EnemyManager();
void update(const Heightmap& heightmap, const Vec4& playerPosition);
void update(const Heightmap& heightmap, const Vec4& playerPosition,
const PlayerShootAction& shootAction);
std::vector<RendererDynamicPair*> getPairs() const;