Otter  0.9.88
2d Game Development Framework based on SFML.Net
 All Classes Namespaces Functions Variables Enumerations Properties
Otter.Counter Class Reference

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
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...
 
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
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< GraphicGraphics [get]
 The list of Graphics from the parent Entity. More...
 
List< ColliderColliders [get]
 The list of Colliders from the parent Entity. More...
 

Detailed Description

Component used for a value with built in min, max, and wrapping capabilities. Can be useful for making menus.

Constructor & Destructor Documentation

Otter.Counter.Counter ( int  value,
int  min,
int  max,
bool  wrap = false,
bool  cap = true 
)

Create a new Counter.

Parameters
valueThe initial value.
minThe minimum value.
maxThe maximum value.
wrapIf the counter should wrap when it reaches the minimum or maximum values.
capIf the counter shouldn't be allowed to exceed the minimum or maximum values.

Member Function Documentation

int Otter.Counter.Decrement ( int  value = 1)

Decrement the value of the Counter.

Parameters
valueHow much to decrement by.
Returns
The new value.
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)

Increment the value of the Counter.

Parameters
valueHow much to increment by.
Returns
The new value.
void Otter.Counter.Reset ( )

Reset the Counter back to its initial value.

override void Otter.Counter.Update ( )
virtual

Update the Counter.

Reimplemented from Otter.Component.

Member Data Documentation

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.

Property Documentation

bool Otter.Counter.AtMax
get

If the Counter is currently at or exceeding the maximum value.

bool Otter.Counter.AtMin
get

If the Counter is currently at or exceeding the minimum value.

int Otter.Counter.Length
get

The length of the Counter from Min to Max.


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