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

Paddle that will automatically follow the AIBall on the side of the screen. More...

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

Public Member Functions

void FixedUpdate ()
 Follow the ball's y position if followBall is set to true. More...
 
void OnCollisionEnter2D (Collision2D collision)
 Check if the object colliding is the AIBall, if so, stop trying to follow the ball. More...
 

Public Attributes

Transform ball
 
float moveSpeed
 
float minDistanceToBall
 
bool followBall
 

Detailed Description

Paddle that will automatically follow the AIBall on the side of the screen.

Member Function Documentation

◆ FixedUpdate()

void AIPlayer.FixedUpdate ( )

Follow the ball's y position if followBall is set to true.

◆ OnCollisionEnter2D()

void AIPlayer.OnCollisionEnter2D ( Collision2D  collision)

Check if the object colliding is the AIBall, if so, stop trying to follow the ball.

Parameters
collisionThe object hitting the player.

Member Data Documentation

◆ ball

Transform AIPlayer.ball

Position of the ball to follow.

◆ followBall

bool AIPlayer.followBall

If true the player will follow the ball.

◆ minDistanceToBall

float AIPlayer.minDistanceToBall

Compares the y positions of the player and the ball, if the distance is less than this threshold then the player is considered even with the ball.

◆ moveSpeed

float AIPlayer.moveSpeed

How fast the paddle should move.


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