Arcade Shooter
Classes | Public Member Functions | List of all members
ShooterLibrary::CollisionManager Class Reference

Handles collisions between game objects. More...

#include <CollisionManager.h>

Public Member Functions

virtual void AddCollisionType (const CollisionType type1, const CollisionType type2, OnCollision callback)
 Adds a type of collision occurance to the manager. More...
 
virtual void AddNonCollisionType (const CollisionType type1, const CollisionType type2)
 Adds a type of collision occurance to make the manager ignore. More...
 
virtual void CheckCollision (GameObject *pGameObject1, GameObject *pGameObject2)
 Determines if two objects are colliding. If they are the specified callback function is run. More...
 

Detailed Description

Handles collisions between game objects.

At the beginning of gameplay, collision types should be added to the manager via CollisionManager::AddCollisionType(). Througout gameplay the Level will make calls to CollisionManager::CheckCollision(), to see if specific game objects are colliding. If a collision is detected, the callback parameter that was specified (when the collision type was added) will be called.

Member Function Documentation

◆ AddCollisionType()

void ShooterLibrary::CollisionManager::AddCollisionType ( const CollisionType  type1,
const CollisionType  type2,
OnCollision  callback 
)
virtual

Adds a type of collision occurance to the manager.

Parameters
type1The collision mask type of the first object.
type2The collision mask type of the second object.
callbackThe callback function that should run when the specified object types collide.

◆ AddNonCollisionType()

void ShooterLibrary::CollisionManager::AddNonCollisionType ( const CollisionType  type1,
const CollisionType  type2 
)
virtual

Adds a type of collision occurance to make the manager ignore.

Parameters
type1The collision mask type of the first object.
type2The collision mask type of the second object.
Remarks
This function is used as an optimization for objects that commonly collide and don't have any affect on gameplay. For example, a player ship that colldes with a projectile that was shot by a player.

◆ CheckCollision()

void ShooterLibrary::CollisionManager::CheckCollision ( GameObject pGameObject1,
GameObject pGameObject2 
)
virtual

Determines if two objects are colliding. If they are the specified callback function is run.

Parameters
pGameObject1The first GameObject.
pGameObject2The second GameObject.
Remarks
This should not be called manually, instead it is called by the level during Level::Update()
See also
Level::Update()

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