SuperTuxKart
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
CheckCannon Class Reference

Implements a simple checkline that will cause a kart or flyable to be shot to a specified point. More...

#include <check_cannon.hpp>

Inheritance diagram for CheckCannon:
Inheritance graph
[legend]

Public Member Functions

 CheckCannon (const XMLNode &node, unsigned int index)
 Constructor for a check cannon.
 
virtual ~CheckCannon ()
 Destructor, frees the curve data (which the cannon animation objects only have a read-only copy of).
 
virtual void trigger (unsigned int kart_index) OVERRIDE
 Is called when this check structure is triggered.
 
virtual void changeDebugColor (bool is_active) OVERRIDE
 Changes the colour of a check cannon depending on state.
 
virtual void update (float dt) OVERRIDE
 Overriden to also check all flyables registered with the cannon.
 
virtual bool triggeringCheckline () const OVERRIDE
 
void addFlyable (Flyable *flyable)
 Adds a flyable to be tested for crossing a cannon checkline.
 
void removeFlyable (Flyable *flyable)
 Removes a flyable from the tests if it crosses a checkline.
 
const Vec3getTargetLeft () const
 
const Vec3getTargetRight () const
 
IpogetIpo () const
 
virtual CheckStructureclone () OVERRIDE
 Clone to child process for server usage (atm no sound or scripting).
 
- Public Member Functions inherited from CheckLine
 CheckLine (const XMLNode &node, unsigned int index)
 Constructor for a checkline.
 
virtual bool isTriggered (const Vec3 &old_pos, const Vec3 &new_pos, int indx) OVERRIDE
 True if going from old_pos to new_pos crosses this checkline.
 
virtual void reset (const Track &track) OVERRIDE
 Initialises the 'previous positions' of all karts with the start position defined for this track.
 
virtual void resetAfterKartMove (unsigned int kart_index) OVERRIDE
 
virtual void resetAfterRewind (unsigned int kart_index) OVERRIDE
 
virtual void changeDebugColor (bool is_active) OVERRIDE
 
virtual bool triggeringCheckline () const OVERRIDE
 
void setIgnoreHeight (bool b)
 Sets if this check line should not do a height test for testing if a line is crossed.
 
virtual void saveCompleteState (BareNetworkString *bns) OVERRIDE
 
virtual void restoreCompleteState (const BareNetworkString &b) OVERRIDE
 
const Vec3getLeftPoint () const
 
const Vec3getRightPoint () const
 
virtual CheckStructureclone () OVERRIDE
 Clone to child process for server usage (atm no sound or scripting).
 
- Public Member Functions inherited from CheckStructure
 CheckStructure (const XMLNode &node, unsigned int index)
 
virtual void update (float dt)
 Updates all check structures.
 
virtual void resetAfterKartMove (unsigned int kart_index)
 
virtual void resetAfterRewind (unsigned int kart_index)
 
virtual void changeDebugColor (bool is_active)
 
virtual bool isTriggered (const Vec3 &old_pos, const Vec3 &new_pos, int indx)=0
 True if going from old_pos to new_pos crosses this checkline.
 
virtual void trigger (unsigned int kart_index)
 Is called when this check structure is triggered.
 
virtual void reset (const Track &track)
 Initialises the 'previous positions' of all karts with the start position defined for this track.
 
CheckType getType () const
 Returns the type of this check structure.
 
void addSuccessor (unsigned int i)
 Adds the index of a successor check structure which will get triggered by this check structure.
 
virtual bool triggeringCheckline () const
 
virtual void saveCompleteState (BareNetworkString *bns)
 
virtual void restoreCompleteState (const BareNetworkString &b)
 
void saveIsActive (int kart_id, BareNetworkString *bns)
 
void restoreIsActive (int kart_id, const BareNetworkString &b)
 
int getIndex () const
 
virtual CheckStructureclone ()=0
 Clone to child process for server usage (atm no sound or scripting).
 

Private Attributes

Vec3 m_target_left
 The target point the kart will fly to.
 
Vec3 m_target_right
 
Ipom_curve
 Stores the cannon curve data.
 
std::set< Flyable * > m_all_flyables
 

Additional Inherited Members

- Public Types inherited from CheckStructure
enum  CheckType {
  CT_NEW_LAP , CT_ACTIVATE , CT_TOGGLE , CT_CANNON ,
  CT_GOAL , CT_AMBIENT_SPHERE , CT_TRIGGER
}
 Different types of check structures: ACTIVATE: Activates another check structure (independent of the state that check structure is in) TOGGLE: Switches (inverts) the state of another check structure. More...
 
- Protected Member Functions inherited from CheckStructure
 CheckStructure ()
 For CheckTrigger or CheckCylinder.
 
- Protected Attributes inherited from CheckStructure
AlignedArray< Vec3m_previous_position
 Stores the previous position of all karts.
 
std::vector< bool > m_is_active
 Stores if this check structure is active (for a given kart).
 
bool m_active_at_reset
 True if this check structure should be activated at a reset.
 
unsigned int m_index
 Stores the index of this check structure.
 

Detailed Description

Implements a simple checkline that will cause a kart or flyable to be shot to a specified point.

Constructor & Destructor Documentation

◆ CheckCannon()

CheckCannon::CheckCannon ( const XMLNode node,
unsigned int  index 
)

Constructor for a check cannon.

Parameters
nodeXML node containing the parameters for this checkline.
indexIndex of this check structure in the check manager.

Member Function Documentation

◆ addFlyable()

void CheckCannon::addFlyable ( Flyable flyable)
inline

Adds a flyable to be tested for crossing a cannon checkline.

Parameters
flyableThe flyable to be tested.

◆ changeDebugColor()

void CheckCannon::changeDebugColor ( bool  is_active)
virtual

Changes the colour of a check cannon depending on state.

Reimplemented from CheckLine.

◆ clone()

CheckStructure * CheckCannon::clone ( )
virtual

Clone to child process for server usage (atm no sound or scripting).

Reimplemented from CheckLine.

◆ removeFlyable()

void CheckCannon::removeFlyable ( Flyable flyable)
inline

Removes a flyable from the tests if it crosses a checkline.

Used when the flyable is removed (e.g. explodes).

◆ trigger()

virtual void CheckCannon::trigger ( unsigned int  kart_index)
inlinevirtual

Is called when this check structure is triggered.

This then can cause a lap to be counted, animation to be started etc.

Reimplemented from CheckStructure.

◆ triggeringCheckline()

virtual bool CheckCannon::triggeringCheckline ( ) const
inlinevirtual

Reimplemented from CheckLine.

◆ update()

void CheckCannon::update ( float  dt)
virtual

Overriden to also check all flyables registered with the cannon.

Reimplemented from CheckStructure.


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