Files
Blitz3/include/blitz/godot/World.h
Persson-dev 1bd053aba3
All checks were successful
Linux arm64 / Build (pull_request) Successful in 1m31s
fix position sync issues
2024-08-21 12:52:00 +02:00

40 lines
953 B
C++

#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;
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, const godot::Vector3& a_Velocity);
};
} // namespace blitz