DoopelPonger
|
Class to handle when objects hit the players shield. More...
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 |
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.
void CoopPlayerShieldCollision.Awake | ( | ) |
Set all references needed by the collider.
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.
collision | The object that collieded with the shield. |
int CoopPlayerShieldCollision.bounceBackMultiplier |
The direction the ball should boune. For example, -1 means the ball should move to the left along the screen.
float CoopPlayerShieldCollision.bounceVelocity |
The speed of the new good ball as it bounces off the shield.
int CoopPlayerShieldCollision.maxNumberOfBounces |
The max number of times a ball should bounce off the shield before the velocity is capped.
CoopMiniBall CoopPlayerShieldCollision.miniBallPrefab |
The prefab of the good ball that should spawn in place of a deflected bad ball.
int CoopPlayerShieldCollision.playerNumber |
The player number the shield belongs to.
float CoopPlayerShieldCollision.verticalFix |
The vertical fix property that should be applied directly to the good ball.