C# Class KineticMath.Controllers.BalanceGame

Controls dynamic of the balance game
Inheritance: System.Windows.DependencyObject
显示文件 Open project: kingston/kineticmath Class Usage Examples

Public Methods

Method Description
AddBallToBalance ( KineticMath.SubControls.SeesawObject ball, bool leftSide ) : void

Adds a ball to the balance

BalanceGame ( ) : System
GetBalanceOffset ( ) : double
GetMaximumValue ( ) : int

Gets the maximum value one side can have (used by Seesaw for angle adjusting)

LoadCurrentLevel ( ) : void
NewGame ( ) : void

Starts a new game and resets everything

PushBall ( KineticMath.SubControls.SeesawObject ball ) : bool

Pushes a ball from the HeldBalls section in the assumption that it'll trigger an animation

Reset ( ) : void

Resets the board to the current level

VerifySolution ( ) : void

Called when the balance has stopped moving and is good to go

Private Methods

Method Description
GetAnswerSet ( int answer, bool moreRandomness = false ) : List
GetRandomPartsToSum ( int numParts, int targetSum ) : int[]

Produces a random array of integers that sum to a target sum

SetupLevel ( ) : void
timerHandler ( Object sender, EventArgs args ) : void

Starts a new game and resets everything

Method Details

AddBallToBalance() public method

Adds a ball to the balance
public AddBallToBalance ( KineticMath.SubControls.SeesawObject ball, bool leftSide ) : void
ball KineticMath.SubControls.SeesawObject
leftSide bool
return void

BalanceGame() public method

public BalanceGame ( ) : System
return System

GetBalanceOffset() public method

public GetBalanceOffset ( ) : double
return double

GetMaximumValue() public method

Gets the maximum value one side can have (used by Seesaw for angle adjusting)
public GetMaximumValue ( ) : int
return int

LoadCurrentLevel() public method

public LoadCurrentLevel ( ) : void
return void

NewGame() public method

Starts a new game and resets everything
public NewGame ( ) : void
return void

PushBall() public method

Pushes a ball from the HeldBalls section in the assumption that it'll trigger an animation
public PushBall ( KineticMath.SubControls.SeesawObject ball ) : bool
ball KineticMath.SubControls.SeesawObject The ball to remove
return bool

Reset() public method

Resets the board to the current level
public Reset ( ) : void
return void

VerifySolution() public method

Called when the balance has stopped moving and is good to go
public VerifySolution ( ) : void
return void