uLua Paddle Game v2.2.0
A paddle game for Unity made as an example use of the uLua toolkit.
uLua.PaddleGame.Game Class Reference

Manages all ball, brick, and paddle objects in the scene and keeps track of various game settings. More...

Public Member Functions

Ball GetBall (int i)
 Returns the ball at index i. More...
 
Brick GetBrick (int i)
 Returns the brick at index i. More...
 
Paddle GetPaddle (int i)
 Returns the paddle at index i. More...
 
Ball AddBall (float X, float Y, float Speed, float Delay, string Name="")
 Adds a ball to the scene. More...
 
Brick AddBrick (float X, float Y, int Health=1, string Name="")
 Adds a brick to the scene. More...
 
Paddle AddPaddle (float X, float Y, float Speed, float Scale=1f, string Name="")
 Adds a paddle to the scene. More...
 
void Clear ()
 Resets the scene by clearing all loaded objects. More...
 
void RemoveBrick (Brick Brick)
 Destroys a brick and removes it from the scene. More...
 
void RemoveBall (Ball Ball)
 Destroys a ball and removes it from the scene. More...
 
void RemovePaddle (Paddle Paddle)
 Destroys a paddle and removes it from the scene. More...
 
void ResetPositions ()
 Resets the position of all balls and paddles loaded in the scene. More...
 
void SlowDown (float SpeedIncrement=0f)
 Resets the speed of all balls and paddles loaded in the scene. More...
 
void SpeedUp (float SpeedIncrement=0f)
 Speeds up all balls and paddles loaded in the scene. More...
 

Protected Member Functions

override void OnExpose ()
 Registers events. More...
 
override void OnDestroy ()
 Saves Lua data when the object is destroyed. More...
 

Properties

int NumBalls [get]
 Returns the number of balls currently loaded in the scene. More...
 
int NumBricks [get]
 Returns the number of bricks currently loaded in the scene. More...
 
int NumPaddles [get]
 Returns the number of paddles currently loaded in the scene. More...
 

Detailed Description

Manages all ball, brick, and paddle objects in the scene and keeps track of various game settings.

All public members of this class are exposed to Lua. Inherits from uLua.ExposedMonoBehaviour.

Member Function Documentation

◆ AddBall()

Ball uLua.PaddleGame.Game.AddBall ( float  X,
float  Y,
float  Speed,
float  Delay,
string  Name = "" 
)
inline

Adds a ball to the scene.

This method is exposed to the API.

Parameters
X,YCoordinates of the new ball object.
SpeedSpeed of the new ball object.
DelayTime before the ball is set in motion.
Name(Optional) Name of the new ball object.

◆ AddBrick()

Brick uLua.PaddleGame.Game.AddBrick ( float  X,
float  Y,
int  Health = 1,
string  Name = "" 
)
inline

Adds a brick to the scene.

This method is exposed to the API.

Parameters
X,YCoordinates of the new brick object.
HealthHealth of the new brick object.
Name(Optional) Name of the new paddle object.

◆ AddPaddle()

Paddle uLua.PaddleGame.Game.AddPaddle ( float  X,
float  Y,
float  Speed,
float  Scale = 1f,
string  Name = "" 
)
inline

Adds a paddle to the scene.

This method is exposed to the API.

Parameters
X,YCoordinates of the new paddle object.
SpeedSpeed of the new paddle object.
Scale(Optional) Scale of the new paddle object.
Name(Optional)Name of the new paddle object.

◆ Clear()

void uLua.PaddleGame.Game.Clear ( )
inline

Resets the scene by clearing all loaded objects.

This method is exposed to the API. Destroys all balls, bricks, and paddles and removes them from the scene.

◆ GetBall()

Ball uLua.PaddleGame.Game.GetBall ( int  i)
inline

Returns the ball at index i.

This method is exposed to the API.

Parameters
iThe index of the object.

◆ GetBrick()

Brick uLua.PaddleGame.Game.GetBrick ( int  i)
inline

Returns the brick at index i.

This method is exposed to the API.

Parameters
iThe index of the object.

◆ GetPaddle()

Paddle uLua.PaddleGame.Game.GetPaddle ( int  i)
inline

Returns the paddle at index i.

This method is exposed to the API.

Parameters
iThe index of the object.

◆ OnDestroy()

override void uLua.PaddleGame.Game.OnDestroy ( )
inlineprotected

Saves Lua data when the object is destroyed.

The "SaveData" field is defined in the Game Lua script in the resource folder.

◆ OnExpose()

override void uLua.PaddleGame.Game.OnExpose ( )
inlineprotected

Registers events.

The event handlers are defined in the Game Lua script in the resource folder.

◆ RemoveBall()

void uLua.PaddleGame.Game.RemoveBall ( Ball  Ball)
inline

Destroys a ball and removes it from the scene.

This method is exposed to the API.

Parameters
BallThe Ball to be removed.

◆ RemoveBrick()

void uLua.PaddleGame.Game.RemoveBrick ( Brick  Brick)
inline

Destroys a brick and removes it from the scene.

This method is exposed to the API.

Parameters
BrickThe Brick to be removed.

◆ RemovePaddle()

void uLua.PaddleGame.Game.RemovePaddle ( Paddle  Paddle)
inline

Destroys a paddle and removes it from the scene.

This method is exposed to the API.

Parameters
PaddleThe Paddle to be removed.

◆ ResetPositions()

void uLua.PaddleGame.Game.ResetPositions ( )
inline

Resets the position of all balls and paddles loaded in the scene.

This method is exposed to the API. Used to reset the scene without changing any game settings.

◆ SlowDown()

void uLua.PaddleGame.Game.SlowDown ( float  SpeedIncrement = 0f)
inline

Resets the speed of all balls and paddles loaded in the scene.

This method is exposed to the API.

Parameters
SpeedIncrement(Optional) The value (per game level) to be retracted from the ball/paddle speed and paddle scale.

◆ SpeedUp()

void uLua.PaddleGame.Game.SpeedUp ( float  SpeedIncrement = 0f)
inline

Speeds up all balls and paddles loaded in the scene.

This method is exposed to the API.

Parameters
SpeedIncrement(Optional) The value to be added to ball/paddle speed and paddle scale.

Property Documentation

◆ NumBalls

int uLua.PaddleGame.Game.NumBalls
get

Returns the number of balls currently loaded in the scene.

This property is exposed to the API.

◆ NumBricks

int uLua.PaddleGame.Game.NumBricks
get

Returns the number of bricks currently loaded in the scene.

This property is exposed to the API.

◆ NumPaddles

int uLua.PaddleGame.Game.NumPaddles
get

Returns the number of paddles currently loaded in the scene.

This property is exposed to the API.