R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
ProjectileCreatedEvent.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** Created by hugo on 15/01/2026
4** File description:
5** ProjectileCreatedEvent.hpp
6*/
7
8#pragma once
9
10#include <cstdint>
12
13namespace server {
14
20 public:
33 explicit ProjectileCreatedEvent(uint32_t projectileId = 0, uint32_t ownerId = 0, float posX = 0.0f,
34 float posY = 0.0f, float dirX = 0.0f, float dirY = 0.0f,
35 float speed = 0.0f, int damage = 0, bool friendly = true)
37 _projectileId(projectileId),
38 _ownerId(ownerId),
39 _posX(posX),
40 _posY(posY),
41 _dirX(dirX),
42 _dirY(dirY),
43 _speed(speed),
44 _damage(damage),
45 _friendly(friendly) {}
46
47 ~ProjectileCreatedEvent() override = default;
48
53 [[nodiscard]] uint32_t getProjectileId() const { return _projectileId; }
54
59 [[nodiscard]] uint32_t getOwnerId() const { return _ownerId; }
60
65 [[nodiscard]] float getPosX() const { return _posX; }
66
71 [[nodiscard]] float getPosY() const { return _posY; }
72
77 [[nodiscard]] float getDirX() const { return _dirX; }
78
83 [[nodiscard]] float getDirY() const { return _dirY; }
84
89 [[nodiscard]] float getSpeed() const { return _speed; }
90
95 [[nodiscard]] int getDamage() const { return _damage; }
96
101 [[nodiscard]] bool isFriendly() const { return _friendly; }
102
103 private:
105 uint32_t _ownerId;
106 float _posX;
107 float _posY;
108 float _dirX;
109 float _dirY;
110 float _speed;
113 };
114
115} // namespace server
Base class for all game-related events.
Definition GameEvent.hpp:19
Event triggered when a new projectile is created in the game.
bool isFriendly() const
Check if projectile is friendly.
float getDirX() const
Get the direction X component.
ProjectileCreatedEvent(uint32_t projectileId=0, uint32_t ownerId=0, float posX=0.0f, float posY=0.0f, float dirX=0.0f, float dirY=0.0f, float speed=0.0f, int damage=0, bool friendly=true)
Constructor.
float getPosY() const
Get the starting Y position.
float getPosX() const
Get the starting X position.
float getDirY() const
Get the direction Y component.
int getDamage() const
Get the projectile damage.
uint32_t getProjectileId() const
Get the projectile entity ID.
uint32_t getOwnerId() const
Get the owner entity ID.
~ProjectileCreatedEvent() override=default
float getSpeed() const
Get the projectile speed.