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

Animation delegate used to change the color of the player. More...

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

Public Member Functions

override void Init (Animator playerAnimator)
 Initialize the animator. More...
 
override void PlayerBadBallHit ()
 The player has been hit with a bad ball. More...
 
override void PlayerGoodBallHit ()
 The player has been hit with a good ball. More...
 
override void PowerUpActivated ()
 The player has activated a power up. More...
 
override void PowerUpChargeChange (float percentCharge, bool prematureActivation)
 The amount of charge the player has has changed. More...
 
override void PowerUpDeactivated ()
 The player has had their power up run out. More...
 
void FixedUpdate ()
 

Public Attributes

Range colorRange
 
float defaultColor
 
float changeRate
 

Detailed Description

Animation delegate used to change the color of the player.

There are three colors used white as the default color, red for when the player gets hit by a bad ball, and yellow for when a good ball hits the player. To change the color of the sprite the Unity Animator's Blend Tree is used with three states, one for each color with. This controller simply changes the value of the blend tree and lets Unity handle the lerping of the different colors.

Member Function Documentation

◆ FixedUpdate()

void CoopPlayerColorAnimatorDelegate.FixedUpdate ( )

◆ Init()

override void CoopPlayerColorAnimatorDelegate.Init ( Animator  playerAnimator)
virtual

Initialize the animator.

Parameters
playerAnimatorThe Unity animator component on the CoopPlayer gameObject.

Implements CoopPlayerAnimatorDelegate.

◆ PlayerBadBallHit()

override void CoopPlayerColorAnimatorDelegate.PlayerBadBallHit ( )
virtual

The player has been hit with a bad ball.

Implements CoopPlayerAnimatorDelegate.

◆ PlayerGoodBallHit()

override void CoopPlayerColorAnimatorDelegate.PlayerGoodBallHit ( )
virtual

The player has been hit with a good ball.

Implements CoopPlayerAnimatorDelegate.

◆ PowerUpActivated()

override void CoopPlayerColorAnimatorDelegate.PowerUpActivated ( )
virtual

The player has activated a power up.

Implements CoopPlayerAnimatorDelegate.

◆ PowerUpChargeChange()

override void CoopPlayerColorAnimatorDelegate.PowerUpChargeChange ( float  percentCharge,
bool  prematureActivation 
)
virtual

The amount of charge the player has has changed.

Parameters
chargePercentThe amount of charge the player has from 0 to 1
prematureActivationMeans that the player tried to use their power up before actually having a full charge.

Implements CoopPlayerAnimatorDelegate.

◆ PowerUpDeactivated()

override void CoopPlayerColorAnimatorDelegate.PowerUpDeactivated ( )
virtual

The player has had their power up run out.

Implements CoopPlayerAnimatorDelegate.

Member Data Documentation

◆ changeRate

float CoopPlayerColorAnimatorDelegate.changeRate

How fast the animator will change between colors.

◆ colorRange

Range CoopPlayerColorAnimatorDelegate.colorRange

The range of the Blend Tree color value. With min being the color when a bad ball hits, max being the color when a good ball hits.

◆ defaultColor

float CoopPlayerColorAnimatorDelegate.defaultColor

The value of the Blend Tree that should be used for the color when the player is not hit by anything.


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