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

Parent level class to control how a ball/bullet moves in the game scene. More...

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

Public Member Functions

void Awake ()
 Initialize references needed by the ball movement object. More...
 
void Init (CoopBall ball)
 Initialize values needed by the ball movement object. More...
 
void ReturnObject ()
 Put this object back in the object pooler for later use. This method should be called when the ball is destroyed. More...
 
Vector2 GetVelocity (float previousAliveTimer, float currentAliveTimer, Vector2 currentDirection)
 Get the new velocity given information about a ball's current velocity. More...
 

Protected Member Functions

abstract Vector2 GetDirectionAndSpeed (float previousAliveTimer, float currentAliveTimer, Vector2 currentDirection)
 Get the new velocity given information about a ball's current velocity. More...
 
abstract void ChildInit (CoopBall ball)
 Initialize values needed by the ball movement object. More...
 

Detailed Description

Parent level class to control how a ball/bullet moves in the game scene.

Member Function Documentation

◆ Awake()

void CoopBallMovement.Awake ( )

Initialize references needed by the ball movement object.

◆ ChildInit()

abstract void CoopBallMovement.ChildInit ( CoopBall  ball)
protectedpure virtual

Initialize values needed by the ball movement object.

Parameters
ballThe ball that needs to have the speed/direction initialized.

Implemented in CoopSineWaveMovement, CoopSquareWaveMovement, CoopTriangleWaveMovement, CoopWhirlyMovement, CoopDecreaseSpeed, CoopIncreaseSpeed, CoopStartStopMovement, and CoopConstantSpeed.

◆ GetDirectionAndSpeed()

abstract Vector2 CoopBallMovement.GetDirectionAndSpeed ( float  previousAliveTimer,
float  currentAliveTimer,
Vector2  currentDirection 
)
protectedpure virtual

Get the new velocity given information about a ball's current velocity.

Parameters
previousAliveTimerThe time the ball was alive the previous tick of the game.
currentAliveTimerThe time the ball has been alive for the current tick of the game.
currentDirectionThe normalized direction the ball is moving.
Returns
The new speed and direction of the ball should move.

Implemented in CoopSineWaveMovement, CoopTriangleWaveMovement, CoopSquareWaveMovement, CoopWhirlyMovement, CoopDecreaseSpeed, CoopIncreaseSpeed, CoopStartStopMovement, and CoopConstantSpeed.

◆ GetVelocity()

Vector2 CoopBallMovement.GetVelocity ( float  previousAliveTimer,
float  currentAliveTimer,
Vector2  currentDirection 
)

Get the new velocity given information about a ball's current velocity.

Parameters
previousAliveTimerThe time the ball was alive the previous tick of the game.
currentAliveTimerThe time the ball has been alive for the current tick of the game.
currentDirectionThe normalized direction the ball is moving.
Returns
The new speed and direction of the ball should move.

◆ Init()

void CoopBallMovement.Init ( CoopBall  ball)

Initialize values needed by the ball movement object.

Parameters
ballThe ball that needs to have the speed/direction initialized.

◆ ReturnObject()

void CoopBallMovement.ReturnObject ( )

Put this object back in the object pooler for later use. This method should be called when the ball is destroyed.


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