DoopelPonger
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
CoopBall Class Referenceabstract

Parent level class for bullets that fly through the game. More...

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

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
 

Detailed Description

Parent level class for bullets that fly through the game.

Member Function Documentation

◆ Awake()

void CoopBall.Awake ( )

Initialize the data needed by the CoopBall

◆ DoNothing()

void CoopBall.DoNothing ( )
protected

Used by the fixedUpdateAction when nothing should be done during the fixed update tick.

◆ DoNothingAction()

bool CoopBall.DoNothingAction ( CoopPlayer  player)
protected

Do nothng special when the ball hits the player and always destroy the ball.

Parameters
playerThe player that was hit by this object.
Returns
Always return true, to destroy this.

◆ FixedUpdate()

void CoopBall.FixedUpdate ( )

Move the ball in the game world.

◆ Init()

void CoopBall.Init ( )

Initialize the variables needed by the CoopBall after it has been returned from the object pooler.

◆ OnAwake()

abstract void CoopBall.OnAwake ( )
protectedpure virtual

Called when the child class should initialize any class level references.

Implemented in CoopBallSplitter, CoopGoodBall, and CoopBadBall.

◆ OnCollisionEnter2D()

void CoopBall.OnCollisionEnter2D ( Collision2D  collision)

Unity says there's a collision, check if it's with a player and do the appropiate actions.

◆ OnInit()

abstract void CoopBall.OnInit ( )
protectedpure virtual

Called when the child class should initialize any class level values.

Implemented in CoopBallSplitter, CoopGoodBall, and CoopBadBall.

◆ PlayerHitAction()

delegate bool CoopBall.PlayerHitAction ( CoopPlayer  player)
protected

Method to call when the player has been hit.

Parameters
playerThe player that was hit by the ball.
Returns
true if the bullet should be deleted, false if the ball should stay in the game.

◆ PlayHitParticle()

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.

◆ ReturnBallMovement()

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.

◆ Start()

void CoopBall.Start ( )

Makes sure the Init method has been called before the first Update tick.

Member Data Documentation

◆ ballMovement

CoopBallMovement CoopBall.ballMovement

How the ball should move through the level.

◆ fixedUpdateAction

CommonDelegates.FixedUpdateAction CoopBall.fixedUpdateAction
protected

Function pointer for the action that should happen in the FixedUpdate.

◆ hitParticleSystem

CoopBallHitParticle CoopBall.hitParticleSystem

◆ objectPooler

CoopObjectPooler CoopBall.objectPooler
protected

◆ particleColor

Color CoopBall.particleColor

Color that the particle system should emit when the ball is despawned.

◆ playerHitAction

PlayerHitAction CoopBall.playerHitAction
protected

Function pointer for the action that should happen when a player gets hit.

◆ verticalChangeRate

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.

◆ verticalRatio

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.


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