Otter
0.9.8.91
2d Game Development Framework based on SFML.Net
|
Component used for a value with built in min, max, and wrapping capabilities. Can be useful for making menus. More...
Inherits Otter.Component.
Public Member Functions | |
Counter (int value, int min, int max, bool wrap=false, bool cap=true) | |
Create a new Counter. More... | |
void | Reset () |
Reset the Counter back to its initial value. More... | |
int | Increment (int value=1) |
Increment the value of the Counter. More... | |
int | Decrement (int value=1) |
Decrement the value of the Counter. More... | |
override void | Update () |
Update the Counter. More... | |
void | GoToMax () |
Force the value to the maximum value. More... | |
void | GoToMin () |
Force the value to the minimum value. More... | |
Public Member Functions inherited from Otter.Component | |
T | GetEntity< T > () |
Get the Entity as a specific Type. More... | |
virtual void | Added () |
Called when the Component is added to the Entity. More... | |
virtual void | Removed () |
Called when the Component is removed from the Entity. More... | |
void | RemoveSelf () |
Removes the Component from its parent Entity. More... | |
virtual void | UpdateFirst () |
Called during the UpdateFirst on the parent Entity. More... | |
virtual void | Render () |
Called during the Render on the parent Entity. More... | |
virtual void | UpdateLast () |
Called during the UpdateLast on the parent Entity. More... | |
T | GetComponent< T > () |
Gets the first Component of type T from this Component's Entity. More... | |
List< T > | GetComponents< T > () |
Gets a list of Components of type T from this Component's Entity. More... | |
Static Public Member Functions | |
static implicit | operator float (Counter counter) |
static implicit | operator int (Counter counter) |
Public Attributes | |
int | Value = 0 |
The current value of the Counter. More... | |
bool | Wrap = false |
Determines if the value should wrap around when exceeding the min or max. More... | |
bool | Cap = true |
Determines if the value should be clamped by the minimum and maximum value. More... | |
int | Min = 0 |
The minimum value of the Counter. More... | |
int | Max = 0 |
The maximum value of the Counter. More... | |
int | InitialValue = 0 |
The starting value of the Counter. More... | |
Action | OnIncrement |
A callback for when the Counter increments. More... | |
Action | OnDecrement |
A callback for when the Counter decrements. More... | |
Action | OnMax |
A callback for when the counter reaches the maximum value. More... | |
Action | OnMin |
A callback for when the counter reaches the minimum value. More... | |
Public Attributes inherited from Otter.Component | |
Entity | Entity |
The parent Entity of the Component. More... | |
bool | RenderAfterEntity = true |
Determines if the Component should render after the Entity has rendered. More... | |
bool | Visible = true |
Determines if the Component will render. More... | |
float | Timer = 0 |
How long the Component has been alive (added to an Entity and updated.) More... | |
Properties | |
bool | AtMax [get] |
If the Counter is currently at or exceeding the maximum value. More... | |
bool | AtMin [get] |
If the Counter is currently at or exceeding the minimum value. More... | |
int | Length [get] |
The length of the Counter from Min to Max. More... | |
Properties inherited from Otter.Component | |
int | InstanceId [get, set] |
The Component's id for the Entity its attached to. More... | |
Scene | Scene [get] |
The Scene that the parent Entity is in. More... | |
Collider | Collider [get] |
The first Collider of the parent Entity. More... | |
Graphic | Graphic [get] |
The first Graphic of the parent Entity. More... | |
List< Graphic > | Graphics [get] |
The list of Graphics from the parent Entity. More... | |
List< Collider > | Colliders [get] |
The list of Colliders from the parent Entity. More... | |
Component used for a value with built in min, max, and wrapping capabilities. Can be useful for making menus.
Otter.Counter.Counter | ( | int | value, |
int | min, | ||
int | max, | ||
bool | wrap = false , |
||
bool | cap = true |
||
) |
Create a new Counter.
value | The initial value. |
min | The minimum value. |
max | The maximum value. |
wrap | If the counter should wrap when it reaches the minimum or maximum values. |
cap | If the counter shouldn't be allowed to exceed the minimum or maximum values. |
int Otter.Counter.Decrement | ( | int | value = 1 | ) |
void Otter.Counter.GoToMax | ( | ) |
Force the value to the maximum value.
void Otter.Counter.GoToMin | ( | ) |
Force the value to the minimum value.
int Otter.Counter.Increment | ( | int | value = 1 | ) |
void Otter.Counter.Reset | ( | ) |
Reset the Counter back to its initial value.
|
virtual |
Update the Counter.
Reimplemented from Otter.Component.
bool Otter.Counter.Cap = true |
Determines if the value should be clamped by the minimum and maximum value.
int Otter.Counter.InitialValue = 0 |
The starting value of the Counter.
int Otter.Counter.Max = 0 |
The maximum value of the Counter.
int Otter.Counter.Min = 0 |
The minimum value of the Counter.
Action Otter.Counter.OnDecrement |
A callback for when the Counter decrements.
Action Otter.Counter.OnIncrement |
A callback for when the Counter increments.
Action Otter.Counter.OnMax |
A callback for when the counter reaches the maximum value.
Action Otter.Counter.OnMin |
A callback for when the counter reaches the minimum value.
int Otter.Counter.Value = 0 |
The current value of the Counter.
bool Otter.Counter.Wrap = false |
Determines if the value should wrap around when exceeding the min or max.
|
get |
If the Counter is currently at or exceeding the maximum value.
|
get |
If the Counter is currently at or exceeding the minimum value.
|
get |
The length of the Counter from Min to Max.