mirror of
https://github.com/zoriya/Bomberman.git
synced 2025-12-21 13:55:10 +00:00
44 lines
1.4 KiB
C++
44 lines
1.4 KiB
C++
//
|
|
// Created by Zoe Roux on 2021-05-14.
|
|
//
|
|
|
|
#pragma once
|
|
|
|
#include <chrono>
|
|
#include "Entity/Entity.hpp"
|
|
|
|
namespace WAL
|
|
{
|
|
//! @brief A base system of WAL
|
|
class System
|
|
{
|
|
public:
|
|
//! @brief A virtual, default, destructor
|
|
virtual ~System() = default;
|
|
//! @brief A system can be moved
|
|
System(System &&) = default;
|
|
|
|
//! @brief Get the name of the component corresponding to this system.
|
|
virtual const std::type_info &getComponent() const = 0;
|
|
|
|
//! @brief Update the corresponding component of the given entity
|
|
//! @param entity The entity to update.
|
|
//! @param dtime The delta time.
|
|
virtual void onUpdate(Entity &entity, std::chrono::nanoseconds dtime);
|
|
|
|
//! @brief An alternative of onUpdate that is called every 8ms (120 times per seconds). If the system slow down, it will try to catch up.
|
|
//! @remark This should be used for Physics, AI and everything that could be imprecise due to float rounding.
|
|
//! @param entity The entity to update.
|
|
virtual void onFixedUpdate(Entity &entity);
|
|
|
|
//! @brief A method called after all entities that this system manage has been updated.
|
|
virtual void onSelfUpdate();
|
|
protected:
|
|
//! @brief A system can't be instantiated, it should be derived.
|
|
System() = default;
|
|
//! @brief A system can't be instantiated, it should be derived.
|
|
System(const System &) = default;
|
|
//! @brief A system can't be instantiated, it should be derived.
|
|
System &operator=(const System &) = default;
|
|
};
|
|
} |