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

The core logic for anything related to the player. This class ended up being a bit too large, so chances are it does basically anything related to the player. More...

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

Public Member Functions

void Awake ()
 Initialize all references, event callbacks, input management, and positioning of the player. More...
 
void OnDestroy ()
 Remove all function pointers being held on to by the input manager or event manager when the player dies. More...
 
void FixedUpdate ()
 Move the player if input is pressed, change the state of animations, and update the invulnerability state. More...
 
void IgnoreRegisterAllInputRequests ()
 Used during the tutorial so that the player cannot be controlled at any point in time. More...
 
void RegisterNewControls (InputManager.InputTriggerOption newTriggerPowerUpOption, InputManager.InputTriggerOption newPlayerMovementOption, InputManager.InputTriggerOption shieldTriggerOption)
 Used when the single player dies and the new player on the right should be spawned with the same input controls as the player on the left. More...
 
void RegisterShield ()
 Tell the player shield to register the callbacks in the InputManager. More...
 
void RegisterMovement ()
 Register the movement options with the InputManager. More...
 
void RegisterPowerUpControls ()
 Register the power up option with the InputManager. More...
 
void DeregisterAllControls ()
 Remove all function pointers away from the InputManager. More...
 
void RegisterAllControls ()
 Register all input options with the InputManager. More...
 
bool GoodBallHit (float chargeAmount)
 A CoopGoodBall hit the player. More...
 
bool BadBallHit ()
 A CoopBadBall hit the player. More...
 
void HitAnimationDone ()
 Unity animation callback for when the hit animation has finished playing. More...
 
InputManager.InputTriggerOption GetShieldTriggerOption ()
 

Public Attributes

InputManager.InputTriggerOption triggerPowerUpOption
 
InputManager.InputTriggerOption playerMovementOption
 
Rigidbody2D rigidbody2d
 
float playerPercentPosition
 
float speed
 
int playerNumber
 
float hitInvulnerableTimer
 
float explosionForce
 
CoopPowerUpController powerUpController
 
float blendRate
 

Static Public Attributes

static readonly float MAX_BLEND = 2
 
static readonly float MIN_BLEND = 0
 
static readonly float MID_BLEND = (MAX_BLEND + MIN_BLEND) / 2
 

Detailed Description

The core logic for anything related to the player. This class ended up being a bit too large, so chances are it does basically anything related to the player.

Member Function Documentation

◆ Awake()

void CoopPlayer.Awake ( )

Initialize all references, event callbacks, input management, and positioning of the player.

◆ BadBallHit()

bool CoopPlayer.BadBallHit ( )

A CoopBadBall hit the player.

Returns
true if the player absorbs the hit. Return false if the attack was blocked.

◆ DeregisterAllControls()

void CoopPlayer.DeregisterAllControls ( )

Remove all function pointers away from the InputManager.

◆ FixedUpdate()

void CoopPlayer.FixedUpdate ( )

Move the player if input is pressed, change the state of animations, and update the invulnerability state.

◆ GetShieldTriggerOption()

InputManager.InputTriggerOption CoopPlayer.GetShieldTriggerOption ( )
Returns
The InputTriggerOption used to activate the shield.

◆ GoodBallHit()

bool CoopPlayer.GoodBallHit ( float  chargeAmount)

A CoopGoodBall hit the player.

Parameters
chargeAmountThe amount of charge that should be added to the player.
Returns
true if the player absorbs the hit. Return false if the attack was blocked.

◆ HitAnimationDone()

void CoopPlayer.HitAnimationDone ( )

Unity animation callback for when the hit animation has finished playing.

◆ IgnoreRegisterAllInputRequests()

void CoopPlayer.IgnoreRegisterAllInputRequests ( )

Used during the tutorial so that the player cannot be controlled at any point in time.

◆ OnDestroy()

void CoopPlayer.OnDestroy ( )

Remove all function pointers being held on to by the input manager or event manager when the player dies.

◆ RegisterAllControls()

void CoopPlayer.RegisterAllControls ( )

Register all input options with the InputManager.

◆ RegisterMovement()

void CoopPlayer.RegisterMovement ( )

Register the movement options with the InputManager.

◆ RegisterNewControls()

void CoopPlayer.RegisterNewControls ( InputManager.InputTriggerOption  newTriggerPowerUpOption,
InputManager.InputTriggerOption  newPlayerMovementOption,
InputManager.InputTriggerOption  shieldTriggerOption 
)

Used when the single player dies and the new player on the right should be spawned with the same input controls as the player on the left.

Parameters
newTriggerPowerUpOptionThe new button used to trigger the power up.
newPlayerMovementOptionThe new buttons used to move the player up and down.
shieldTriggerOptionThe new button to trigger the player's shield.

◆ RegisterPowerUpControls()

void CoopPlayer.RegisterPowerUpControls ( )

Register the power up option with the InputManager.

◆ RegisterShield()

void CoopPlayer.RegisterShield ( )

Tell the player shield to register the callbacks in the InputManager.

Member Data Documentation

◆ blendRate

float CoopPlayer.blendRate

How fast the player sprite changes animation state when getting hit/increasing size when dodging balls.

◆ explosionForce

float CoopPlayer.explosionForce

When the player dies, they explode into several pieces. This force pushes all the pieces aware from the center of mass.

◆ hitInvulnerableTimer

float CoopPlayer.hitInvulnerableTimer

The amount of time the player should be invulnerable after getting hit before they can get hit again.

◆ MAX_BLEND

readonly float CoopPlayer.MAX_BLEND = 2
static

◆ MID_BLEND

readonly float CoopPlayer.MID_BLEND = (MAX_BLEND + MIN_BLEND) / 2
static

◆ MIN_BLEND

readonly float CoopPlayer.MIN_BLEND = 0
static

◆ playerMovementOption

InputManager.InputTriggerOption CoopPlayer.playerMovementOption

The InputTriggerOption used to move the player up and down.

◆ playerNumber

int CoopPlayer.playerNumber

Number of the player, used to identify the different players.

◆ playerPercentPosition

float CoopPlayer.playerPercentPosition

The percent of x axis that the player should spawn at.

◆ powerUpController

CoopPowerUpController CoopPlayer.powerUpController

Reference to the code that manages the power the player has, the amount of power up charge, etc.

◆ rigidbody2d

Rigidbody2D CoopPlayer.rigidbody2d

The rigidbody that should be used to change the velocity of when movement is necessary.

◆ speed

float CoopPlayer.speed

How fast the player should move.

◆ triggerPowerUpOption

InputManager.InputTriggerOption CoopPlayer.triggerPowerUpOption

The InputTriggerOption used to trigger the power up.


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