The Table Engine
CollisionScript Class Reference

Script to manage collisions between game objects. More...

#include <collision_script.h>

+ Inheritance diagram for CollisionScript:
+ Collaboration diagram for CollisionScript:

Public Member Functions

 CollisionScript ()
 Constructs a new Collision Script object. More...
 
void update () override
 Updates the collision status of the associated game object. More...
 
void render () override
 Renders collision-related visuals if necessary. More...
 
- Public Member Functions inherited from Script
 Script ()
 Default constructor, initializes an empty script. More...
 
 Script (std::string name)
 Constructs a Script with a specified name. More...
 
virtual ~Script ()
 Virtual destructor to allow for cleanup in derived script classes. More...
 
std::string getName ()
 Retrieves the name of the script. More...
 
GameObjectgetOwner ()
 Retrieves the owner GameObject of this script. More...
 
void setOwner (GameObject *owner)
 Sets the owner of this script. More...
 
virtual void input ()
 Virtual method for handling input. Should be overridden by derived classes. More...
 

Private Attributes

bool m_collide
 

Additional Inherited Members

- Public Attributes inherited from Script
std::string m_name
 Name of the script, useful for identification or debugging. More...
 
GameObjectm_owner
 Pointer to the GameObject that owns this script. More...
 

Detailed Description

Script to manage collisions between game objects.

Inherits from the Script class and utilizes the Collide component to handle collisions.

Definition at line 19 of file collision_script.h.

Constructor & Destructor Documentation

◆ CollisionScript()

CollisionScript::CollisionScript ( )

Constructs a new Collision Script object.

Initializes the collision flag to false.

Definition at line 9 of file collision_script.cpp.

Member Function Documentation

◆ render()

void CollisionScript::render ( )
overridevirtual

Renders collision-related visuals if necessary.

This method is called once per frame after update(), if there is a need to render visual cues related to collision (like debug outlines).

Reimplemented from Script.

Definition at line 33 of file collision_script.cpp.

◆ update()

void CollisionScript::update ( )
overridevirtual

Updates the collision status of the associated game object.

This method is called once per frame and checks for any collisions that involve the game object this script is attached to.

Reimplemented from Script.

Definition at line 13 of file collision_script.cpp.

Member Data Documentation

◆ m_collide

bool CollisionScript::m_collide
private

Flag to track collision state

Definition at line 21 of file collision_script.h.


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