DoopelPonger
|
Parent level class for bullets that fly through the game. More...
Public Member Functions | |
void | Awake () |
void | Start () |
void | Init () |
void | FixedUpdate () |
void | OnCollisionEnter2D (Collision2D collision) |
void | PlayHitParticle () |
Force the ball to play the particle used when the ball hits a player. Used in cases where an external collision wants to destroy the ball, like hitting the player's shield. More... | |
void | ReturnBallMovement () |
Force the ball to return the movement controller to the object pooler. Used in cases where an external collision wants to destroy the ball, like hitting the player's shield. More... | |
Public Attributes | |
Color | particleColor |
CoopBallMovement | ballMovement |
float | verticalRatio = .8f |
float | verticalChangeRate = .5f |
CoopBallHitParticle | hitParticleSystem |
Protected Member Functions | |
delegate bool | PlayerHitAction (CoopPlayer player) |
abstract void | OnAwake () |
Called when the child class should initialize any class level references. More... | |
abstract void | OnInit () |
Called when the child class should initialize any class level values. More... | |
void | DoNothing () |
Used by the fixedUpdateAction when nothing should be done during the fixed update tick. More... | |
bool | DoNothingAction (CoopPlayer player) |
Do nothng special when the ball hits the player and always destroy the ball. More... | |
Protected Attributes | |
CoopObjectPooler | objectPooler |
CommonDelegates.FixedUpdateAction | fixedUpdateAction |
PlayerHitAction | playerHitAction |
Parent level class for bullets that fly through the game.
void CoopBall.Awake | ( | ) |
Initialize the data needed by the CoopBall
|
protected |
Used by the fixedUpdateAction when nothing should be done during the fixed update tick.
|
protected |
Do nothng special when the ball hits the player and always destroy the ball.
player | The player that was hit by this object. |
void CoopBall.FixedUpdate | ( | ) |
Move the ball in the game world.
void CoopBall.Init | ( | ) |
Initialize the variables needed by the CoopBall after it has been returned from the object pooler.
|
protectedpure virtual |
Called when the child class should initialize any class level references.
Implemented in CoopBallSplitter, CoopGoodBall, and CoopBadBall.
void CoopBall.OnCollisionEnter2D | ( | Collision2D | collision | ) |
Unity says there's a collision, check if it's with a player and do the appropiate actions.
|
protectedpure virtual |
Called when the child class should initialize any class level values.
Implemented in CoopBallSplitter, CoopGoodBall, and CoopBadBall.
|
protected |
Method to call when the player has been hit.
player | The player that was hit by the ball. |
void CoopBall.PlayHitParticle | ( | ) |
Force the ball to play the particle used when the ball hits a player. Used in cases where an external collision wants to destroy the ball, like hitting the player's shield.
void CoopBall.ReturnBallMovement | ( | ) |
Force the ball to return the movement controller to the object pooler. Used in cases where an external collision wants to destroy the ball, like hitting the player's shield.
void CoopBall.Start | ( | ) |
Makes sure the Init method has been called before the first Update tick.
CoopBallMovement CoopBall.ballMovement |
How the ball should move through the level.
|
protected |
Function pointer for the action that should happen in the FixedUpdate.
CoopBallHitParticle CoopBall.hitParticleSystem |
|
protected |
Color CoopBall.particleColor |
Color that the particle system should emit when the ball is despawned.
|
protected |
Function pointer for the action that should happen when a player gets hit.
float CoopBall.verticalChangeRate = .5f |
The amount of velocity to add on the x axis if the ball is moving too much on the y axis.
float CoopBall.verticalRatio = .8f |
We don't want the ball to move vertical, since it will never get to the player. So we look at the ratio of velocity.y/velocity.x and if that ratio is greater than this ratio, then nudge the ball closer to the x direction.