Paddle that will automatically follow the AIBall on the side of the screen.
More...
Paddle that will automatically follow the AIBall on the side of the screen.
◆ 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
-
collision | The object hitting the player. |
◆ ball
Position of the ball to follow.
◆ 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
How fast the paddle should move.
The documentation for this class was generated from the following file: