make world abstract
All checks were successful
Linux arm64 / Build (pull_request) Successful in 1m36s

This commit is contained in:
2024-08-19 16:19:45 +02:00
parent 3cebb70289
commit a092f6fbc1
14 changed files with 180 additions and 65 deletions

View File

@@ -0,0 +1,40 @@
#pragma once
#include <godot_cpp/classes/node3d.hpp>
#include <blitz/protocol/PacketHandler.h>
namespace blitz {
class Player;
class NetworkInterface;
class World : public godot::Node3D, public protocol::PacketHandler {
GDCLASS(World, godot::Node3D)
protected:
static void _bind_methods();
World();
~World();
public:
// Godot overrides
void _ready() override;
Player* GetPlayerById(PlayerID a_PlayerId);
void HandlePacket(const protocol::packets::PlayerJoin&) override;
void HandlePacket(const protocol::packets::PlayerLeave&) override;
void HandlePacket(const protocol::packets::PlayerPositionAndRotation&) override;
protected:
NetworkInterface* m_NetworkInterface;
godot::Node* m_Players;
float m_PassedTime;
void AddPlayer(PlayerID a_PlayerId, godot::String a_PlayerName);
void RemovePlayer(PlayerID a_PlayerId);
void SetPlayerPositionAndRotation(PlayerID a_PlayerId, const godot::Vector3& a_Position, const godot::Vector3& a_Rotation);
};
} // namespace blitz