add StateMachine
This commit is contained in:
@@ -1,29 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <client/IClientSocket.h>
|
||||
#include <client/IClientState.h>
|
||||
#include <chrono>
|
||||
#include <td/common/StateMachine.h>
|
||||
|
||||
namespace td {
|
||||
namespace client {
|
||||
|
||||
class Client {
|
||||
class ClientState;
|
||||
|
||||
class Client : public StateMachine<Client, void, float> {
|
||||
private:
|
||||
std::shared_ptr<IClientSocket> m_Socket;
|
||||
std::shared_ptr<IClientState> m_State;
|
||||
std::chrono::time_point<std::chrono::system_clock> m_LastTime;
|
||||
|
||||
public:
|
||||
Client(const std::shared_ptr<IClientSocket>& a_Socket) : m_Socket(a_Socket), m_LastTime(std::chrono::system_clock::now()) {}
|
||||
Client(const std::shared_ptr<IClientSocket>& a_Socket) : m_Socket(a_Socket) {}
|
||||
|
||||
void Update();
|
||||
|
||||
void UpdateState(const std::shared_ptr<IClientState>& a_State);
|
||||
|
||||
private:
|
||||
void Update(float a_Delta);
|
||||
|
||||
friend class IClientState;
|
||||
friend class ClientState;
|
||||
};
|
||||
|
||||
} // namespace client
|
||||
|
||||
Reference in New Issue
Block a user