DoopelPonger
Public Member Functions | Public Attributes | List of all members
CoopPlayerShieldCollision Class Reference

Class to handle when objects hit the players shield. More...

Inheritance diagram for CoopPlayerShieldCollision:
Inheritance graph
[legend]
Collaboration diagram for CoopPlayerShieldCollision:
Collaboration graph
[legend]

Public Member Functions

void Awake ()
 Set all references needed by the collider. More...
 
void OnCollisionEnter2D (Collision2D collision)
 Process any object that has hit the shield. Bad balls will be removed and replaced with the miniBallPrefabe. MiniBalls will bounce back with an increased velocity. More...
 

Public Attributes

CoopMiniBall miniBallPrefab
 
int playerNumber
 
int bounceBackMultiplier
 
float bounceVelocity
 
float verticalFix
 
int maxNumberOfBounces
 

Detailed Description

Class to handle when objects hit the players shield.

Whenever a bad ball hits the shield, that ball should be deleted and a good ball should be spawned moving in the direction as if the bad ball had bounced off the shield. Any good balls should also bounce off the shield, but they should not be destroyed but bounce back as one would expect.

Member Function Documentation

◆ Awake()

void CoopPlayerShieldCollision.Awake ( )

Set all references needed by the collider.

◆ OnCollisionEnter2D()

void CoopPlayerShieldCollision.OnCollisionEnter2D ( Collision2D  collision)

Process any object that has hit the shield. Bad balls will be removed and replaced with the miniBallPrefabe. MiniBalls will bounce back with an increased velocity.

Parameters
collisionThe object that collieded with the shield.

Member Data Documentation

◆ bounceBackMultiplier

int CoopPlayerShieldCollision.bounceBackMultiplier

The direction the ball should boune. For example, -1 means the ball should move to the left along the screen.

◆ bounceVelocity

float CoopPlayerShieldCollision.bounceVelocity

The speed of the new good ball as it bounces off the shield.

◆ maxNumberOfBounces

int CoopPlayerShieldCollision.maxNumberOfBounces

The max number of times a ball should bounce off the shield before the velocity is capped.

◆ miniBallPrefab

CoopMiniBall CoopPlayerShieldCollision.miniBallPrefab

The prefab of the good ball that should spawn in place of a deflected bad ball.

◆ playerNumber

int CoopPlayerShieldCollision.playerNumber

The player number the shield belongs to.

◆ verticalFix

float CoopPlayerShieldCollision.verticalFix

The vertical fix property that should be applied directly to the good ball.


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