R-TYPE
Public Member Functions | List of all members
ECS::Speed Class Reference

#include <Speed.hpp>

Inheritance diagram for ECS::Speed:
ECS::IComp

Public Member Functions

 Speed (int maxSpeed) noexcept
 
 Speed (const Speed &speed) noexcept
 
 Speed (Speed &&) noexcept=delete
 
 ~Speed () noexcept override=default
 
Speedoperator= (const Speed &) const noexcept=delete
 
Speedoperator= (Speed &&) const noexcept=delete
 
int getSpeed () const noexcept
 
int getMaxSpeed () const noexcept
 
void addSpeed (int const speedToAdd) noexcept
 
void removeSpeed (int const speedToRemove) noexcept
 
void setSpeed (int const speedToSet) noexcept
 
void setMaxSpeed (int const speedToSet) noexcept
 
- Public Member Functions inherited from ECS::IComp
virtual ~IComp () noexcept=default
 

Constructor & Destructor Documentation

◆ Speed() [1/3]

ECS::Speed::Speed ( int  maxSpeed)
explicitnoexcept

A constructor for the Speed class.

Parameters
speedThe maximum speed of the entity.

◆ Speed() [2/3]

ECS::Speed::Speed ( const Speed speed)
noexcept

Copy constructor for the Speed component.

Parameters
speedThe speed of the entity.

◆ Speed() [3/3]

ECS::Speed::Speed ( Speed &&  )
explicitdeletenoexcept

◆ ~Speed()

ECS::Speed::~Speed ( )
overridedefaultnoexcept

Member Function Documentation

◆ addSpeed()

void ECS::Speed::addSpeed ( int const  speedToAdd)
noexcept

If the speed is greater than the max speed, set the speed to the max speed, otherwise add the speed to the current speed

Parameters
speedThe speed of the entity.

◆ getMaxSpeed()

int ECS::Speed::getMaxSpeed ( ) const
noexcept

This function returns the maximum speed of the entity.

Returns
The max speed of the entity.

◆ getSpeed()

int ECS::Speed::getSpeed ( ) const
noexcept

It returns the speed of the entity.

Returns
The speed of the entity.

◆ operator=() [1/2]

Speed& ECS::Speed::operator= ( const Speed ) const
deletenoexcept

◆ operator=() [2/2]

Speed& ECS::Speed::operator= ( Speed &&  ) const
deletenoexcept

◆ removeSpeed()

void ECS::Speed::removeSpeed ( int const  speedToRemove)
noexcept

If the speed is less than zero, set the speed to zero, otherwise subtract the speed

Parameters
speedThe speed of the entity.

◆ setMaxSpeed()

void ECS::Speed::setMaxSpeed ( int const  speedToSet)
noexcept

This function returns the maximum speed of the entity.

Returns
The max speed of the entity.

◆ setSpeed()

void ECS::Speed::setSpeed ( int const  speedToSet)
noexcept

Sets the speed of the entity.

Parameters
speedThe speed of the entity.

The documentation for this class was generated from the following files: