R-Type  2
Doom but in better
Loading...
Searching...
No Matches
WeaponSystem.cpp File Reference
#include "WeaponSystem.hpp"
#include "IndexedZipper.hpp"
#include "SpawnSystem.hpp"
#include "Time.hpp"
Include dependency graph for WeaponSystem.cpp:

Go to the source code of this file.

Functions

void weapon_system (Registry &r, ComponentContainer< Weapon > &weapons, ComponentContainer< Position > &positions, ComponentContainer< Type > &types)
 Handles the firing of weapons and updates their states.
 
void make_shot (Registry &r, std::size_t id)
 Changes the state of the weapon.
 

Function Documentation

◆ make_shot()

void make_shot ( Registry & r,
std::size_t id )

Changes the state of the weapon.

Parameters
rThe Registry that contains all game entities and their components.
idThe id of the entity.

Definition at line 23 of file WeaponSystem.cpp.

◆ weapon_system()

void weapon_system ( Registry & r,
ComponentContainer< Weapon > & weapons,
ComponentContainer< Position > & positions,
ComponentContainer< Type > & types )

Handles the firing of weapons and updates their states.

This system manages the firing mechanism of entities that possess a Weapon component. It checks if the entity is ready to fire based on the weapon's cooldown time and fire rate. When an entity fires a weapon, a missile or projectile is spawned, and the weapon's cooldown timer is reset.

Parameters
rThe Registry that contains all game entities and their components.
weaponsThe container of the component Weapon.
positionsThe container of the component Position.
typesThe container of the component Type.

Definition at line 6 of file WeaponSystem.cpp.