#include <CSWPySubmarine.h>
Public Member Functions | |
CSWPySubmarine (std::string strName, double fLength) | |
virtual void | initialize () |
virtual void | update () |
virtual bool | processEvent (std::shared_ptr< CSWEvent > pEvent) |
virtual void | finalize () |
std::shared_ptr< ARSTD::CommandProcessor > | getCommandProcessor () |
std::shared_ptr< CSWEngine > | getMainEngine () |
std::shared_ptr< CSWEngine > | getBowsJetOar () |
std::shared_ptr< CSWEngine > | getInclinationJetOar () |
std::shared_ptr< CSWEngine > | getAxialInclinationJetOar () |
std::shared_ptr< CSWEngine > | getBuoyancyTank () |
std::shared_ptr< CSWControlCenter > | getControlCenter () |
std::shared_ptr< CSWWeaponBattery > | getFrontLeftWeaponBattery () |
std::shared_ptr< CSWWeaponBattery > | getFrontRightWeaponBattery () |
std::shared_ptr< CSWWeaponBattery > | getBackWeaponBattery () |
const double & | getHealth () const |
void | setColor (const Vector4D &vecColor) |
const Vector4D & | getColor () |
Vector3D | makeLocalDirection (const Vector3D &vecWorldTDirection) |
Vector3D | makeGlobalDirection (const Vector3D &vecObjectTDirection) |
Vector3D | makeLocalPosition (const Vector3D &vecWorldTPosition) |
Vector3D | makeGlobalPosition (const Vector3D &vecObjectTPosition) |
![]() | |
const std::string & | getName () const |
This is the base class for submarines defined in python. Submarines are the main actors in the world. Specialized submarines are defined in python. Therefore its behavior is very different. All submarines have the same equipment and the same types of weapons on bord. They are identically except its length. The length must be given in the constructor and must be in range [30, 110] m. The power of engines and the capacity of the weapon batteries is depend on the submarine length. Larger submarines have more powerful engines and a higher capacity of the weapon batteries. But larger submarines can be better hit and detected by sonar than smaller ones. Smaller ones are a bit faster in controlling rotation and position.
Submarines are equipped with:
CodeSubWars::CSWPySubmarine::CSWPySubmarine | ( | std::string | strName, |
double | fLength | ||
) |
Constructs a new submarine.
strName | The name of the new submarine. |
fLength | The length of the new submarine. |
|
virtual |
This method should be overriden if finalizations must be done. Its ensured that this method is called directly before destructing.
Reimplemented from CodeSubWars::CSWObject.
std::shared_ptr< CSWEngine > CodeSubWars::CSWPySubmarine::getAxialInclinationJetOar | ( | ) |
Returns the axial inclination jet oar.
std::shared_ptr< CSWWeaponBattery > CodeSubWars::CSWPySubmarine::getBackWeaponBattery | ( | ) |
Returns the back weapon battery.
std::shared_ptr< CSWEngine > CodeSubWars::CSWPySubmarine::getBowsJetOar | ( | ) |
Returns the bows jet oar.
std::shared_ptr< CSWEngine > CodeSubWars::CSWPySubmarine::getBuoyancyTank | ( | ) |
Returns the buoyancy tank.
|
virtual |
Returns the color of the object.
Reimplemented from CodeSubWars::CSWDynSolCol.
|
virtual |
Returns the command processor. The behavior is like in real life your 1st commander. You (the captain) makes a list of commands that must be done. This list is given to the commander. He cares about the correct execution. Ones you give him the list of commands you are able to do other things while your commander do the execution.
Reimplemented from CodeSubWars::CSWSubmarine.
std::shared_ptr< CSWControlCenter > CodeSubWars::CSWPySubmarine::getControlCenter | ( | ) |
Returns the control center.
std::shared_ptr< CSWWeaponBattery > CodeSubWars::CSWPySubmarine::getFrontLeftWeaponBattery | ( | ) |
Returns the front left weapon battery.
std::shared_ptr< CSWWeaponBattery > CodeSubWars::CSWPySubmarine::getFrontRightWeaponBattery | ( | ) |
Returns the front right weapon battery.
|
virtual |
Returns the current health of the submarine.
Reimplemented from CodeSubWars::CSWDamDynSolCol.
std::shared_ptr< CSWEngine > CodeSubWars::CSWPySubmarine::getInclinationJetOar | ( | ) |
Returns the inclination jet oar.
std::shared_ptr< CSWEngine > CodeSubWars::CSWPySubmarine::getMainEngine | ( | ) |
Returns the main engine.
|
virtual |
This method should be overriden if initializations must be done. Here all sensors return correct values. Its ensured that this method is called before any other method (except constructor) is called.
Reimplemented from CodeSubWars::CSWObject.
Vector3D CodeSubWars::CSWPySubmarine::makeGlobalDirection | ( | const Vector3D & | vecObjectTDirection | ) |
Transforms a direction given in local coordinate system into the world coordinate system.
vecObjectTDirection | The direction in local coordinate system. |
Vector3D CodeSubWars::CSWPySubmarine::makeGlobalPosition | ( | const Vector3D & | vecObjectTPosition | ) |
Transforms a position given in local coordinate system into the world coordinate system.
vecObjectTPosition | The position in local coordinate system. |
Vector3D CodeSubWars::CSWPySubmarine::makeLocalDirection | ( | const Vector3D & | vecWorldTDirection | ) |
Transforms a direction given in world coordinate system into the local system.
vecWorldTDirection | The direction in world coordinate system. |
Vector3D CodeSubWars::CSWPySubmarine::makeLocalPosition | ( | const Vector3D & | vecWorldTPosition | ) |
Transforms a position given in world coordinate system into the local system.
vecWorldTPosition | The position in world coordinate system. |
|
virtual |
This method must be overriden in the specialized class. This methode is called if an event has been received by the object that should be processed. Returning true reports the eventmanager that the event passed to the object has successfully processed and delete it. When returning false the event will be delivered the next time again until it expires or processed successfully. The main function should be reacting to events e.g. seting up commands or something like that. The specialized class can implement everything here, but the execution time must not exceed 6ms in average. If it does the object will be kicked from the world!
pEvent | The incoming event that should be processed. |
Reimplemented from CodeSubWars::CSWSubmarine.
|
virtual |
Sets the color of the submarine.
vecColor | The new red-green-blue-alpha - color. each color component in range [0, 1]. |
Reimplemented from CodeSubWars::CSWDynSolCol.
|
virtual |
This method must be overriden in the specialized class. This methode is called periodically about every 10ms. The main function should be checking sensors, seting up commands or something like that. The specialized class can implement everything here, but the execution time must not exceed 6ms in average. If it does the object will be kicked from the world!
Reimplemented from CodeSubWars::CSWSubmarine.