| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "../SolidObjectBase.h" |
| 4 |
#include "../../EventType.h" |
| 5 |
|
| 6 |
namespace Jazz2::Actors::Solid |
| 7 |
{ |
| 8 |
/** @brief Base class of an item container */ |
| 9 |
class GenericContainer : public SolidObjectBase |
| 10 |
{ |
| 11 |
DEATH_RUNTIME_OBJECT(SolidObjectBase); |
| 12 |
|
| 13 |
public: |
| 14 |
GenericContainer(); |
| 15 |
|
| 16 |
bool CanCauseDamage(ActorBase* collider) override; |
| 17 |
|
| 18 |
protected: |
| 19 |
/** @brief Container content item */ |
| 20 |
struct ContainerContent { |
| 21 |
/** @brief Event type */ |
| 22 |
EventType Type; |
| 23 |
/** @brief Object count */ |
| 24 |
std::int32_t Count; |
| 25 |
/** @brief Event parameters */ |
| 26 |
std::uint8_t EventParams[16]; |
| 27 |
|
| 28 |
ContainerContent(EventType eventType, std::int32_t count, const std::uint8_t* eventParams, std::int32_t eventParamsSize); |
| 29 |
}; |
| 30 |
|
| 31 |
SmallVector<ContainerContent, 1> _content; |
| 32 |
|
| 33 |
bool OnPerish(ActorBase* collider) override; |
| 34 |
|
| 35 |
/** @brief Adds a content to the container */ |
| 36 |
void AddContent(EventType eventType, std::int32_t count, const std::uint8_t* eventParams, std::int32_t eventParamsSize); |
| 37 |
/** @brief Spawns the added content */ |
| 38 |
void SpawnContent(); |
| 39 |
}; |
| 40 |
} |