brodacast shoot

This commit is contained in:
2024-08-27 16:21:42 +02:00
parent 2353cbb2be
commit 89b62317d4
6 changed files with 52 additions and 12 deletions

View File

@@ -25,13 +25,15 @@ class World : public godot::Node3D, public protocol::PacketHandler {
void HandlePacket(const protocol::packets::PlayerJoin&) override;
void HandlePacket(const protocol::packets::PlayerLeave&) override;
void HandlePacket(const protocol::packets::PlayerShoot&) override;
protected:
NetworkInterface* m_NetworkInterface;
godot::Node* m_Players;
float m_PassedTime;
virtual void AddProjectile(
PlayerID a_Shooter, const godot::Vector3& a_Position, const godot::Vector3& a_Rotation, const godot::Vector3& a_Velocity);
virtual void AddPlayer(PlayerID a_PlayerId, godot::String a_PlayerName);
virtual void RemovePlayer(PlayerID a_PlayerId);
virtual void SetPlayerPositionAndRotation(

View File

@@ -1,9 +1,9 @@
#pragma once
#include <blitz/common/Types.h>
#include <vector>
#include <godot_cpp/variant/string.hpp>
#include <godot_cpp/variant/vector3.hpp>
#include <vector>
namespace blitz {
namespace protocol {
@@ -66,7 +66,12 @@ struct PlayerPositionAndRotation {
godot::Vector3 m_Velocity;
};
struct PlayerShoot {};
struct PlayerShoot {
PlayerID m_Sender;
godot::Vector3 m_Position;
godot::Vector3 m_Rotation;
godot::Vector3 m_Velocity;
};
} // namespace data
} // namespace protocol

View File

@@ -5,6 +5,8 @@
namespace blitz {
class NetworkInterface;
class PlayerController : public godot::Node {
GDCLASS(PlayerController, godot::Node)
protected:
@@ -25,6 +27,7 @@ class PlayerController : public godot::Node {
float m_Speed;
Player* m_Player;
godot::Node3D* m_Head;
NetworkInterface* m_NetworkInterface;
void UpdateBobbing(float delta);
void UpdateFOV(float delta);