aboutsummaryrefslogtreecommitdiff
path: root/examples/basic/src/interfaces/enemy.hpp
blob: 5ad7d901c1211b19efb7577514bb21837a18dcce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#pragma once

#include <yacppdic/factory.hpp>

#include <memory>

// NOLINTNEXTLINE(modernize-avoid-c-arrays, cppcoreguidelines-avoid-c-arrays)
constexpr char SMALL_ENEMY_TAG[] = "small";

// NOLINTNEXTLINE(modernize-avoid-c-arrays, cppcoreguidelines-avoid-c-arrays)
constexpr char BIG_ENEMY_TAG[] = "big";

// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
class IEnemy
{
public:
	virtual ~IEnemy() noexcept = default;

	[[nodiscard]] virtual auto get_health() const noexcept -> int = 0;

	virtual void do_damage(int damage) noexcept = 0;
};

using IEnemyFactory = yacppdic::Factory<std::unique_ptr<IEnemy>()>;