Inheritance diagram for HealthBar:
PowerUI.DynamicTexture

Public Member Functions

 HealthBar ()
 
void IncreaseHealth (float delta)
 Increases (or decreases for a negative) the current value of the bar. More...
 
void SetHealth (float health)
 Sets the active value of this bar. More...
 
override void Flush ()
 Writes the pixels out to the screen. More...
 
void DrawArc (int linesGreen)
 Draws the arched/curved section of the bar. More...
 
void DrawHalfCircle (int x0, int y0, int linesGreen, bool leftwards)
 Draws a half of a circle to the image. More...
 
- Public Member Functions inherited from PowerUI.DynamicTexture
 DynamicTexture (int width, int height, string name)
 Creates a new dynamic texture of the given dimensions. More...
 
 DynamicTexture ()
 Creates an empty dynamic texture. Note that this is used internally by canvas. If used, you must call Resize to set it up. More...
 
void ResizeX (int width)
 Resize this texture on the X axis. More...
 
void ResizeY (int height)
 Resize this texture on the Y axis. More...
 
void Resize (int width, int height)
 Resize this texture on the X and Y axis. More...
 
void Resize (int width, int height, bool createIfZero)
 Resize this texture on the X and Y axis, optionally only doing so if dimensions aren't zero. More...
 
Texture2D GetTexture ()
 Gets the texture. More...
 
Texture2D GetTextureHolder ()
 Gets the placeholder texture. More...
 
void DrawPixel (int x, int y, Color32 colour)
 Draws a pixel at the given x/y coordinates to the atlas. More...
 
void DrawLine (int x, int y, int x2, int y2, Color32 colour)
 Draws a line on the atlas from one point to another. More...
 
void DrawCircle (int x0, int y0, int radius, Color32 colour)
 Draws a filled circle on the atlas. More...
 
void Clear ()
 Wipes the graphic clean using transparent black. More...
 
void Clear (Color32 clearColour)
 Wipes the graphic clean. More...
 
void SetPixel (int index, Color32 colour)
 Sets a the colour of a particular global pixel on the atlas. More...
 
void Refresh ()
 Called to refresh the texture. More...
 
void FlushDirect ()
 Internally used only. Flushes the pixel array to the texture right now. More...
 

Public Attributes

float Health =0f
 The active value from 0->1 of this bar. More...
 
int PixelLines =0
 The number of lines drawn to display the bar. More...
 
int[] InnerCircleSetX
 The arc of the bar is drawn as a series of lines starting at an inner circle (inner edge of the bar) to the outer circle (outer edge). The following values represent the x and y coordinates of the start (inner) and end (outer) of these lines. They are computed by essentially rotating around the center of the circles. More...
 
int[] OuterCircleSetX
 
int[] InnerCircleSetY
 
int[] OuterCircleSetY
 
Color UnlitColour =Color.red
 The colour of an empty bar. More...
 
Color LitColour =Color.green
 The colour of a full bar. More...
 
int[] HalfCircleY =new int[]{5,4,4,3,1}
 The y pixel coordinates using the array index as x to draw a quarter circle. The values are essentially mirrored over x to produce a half circle for the ends of the bar. More...
 
- Public Attributes inherited from PowerUI.DynamicTexture
int Width
 The width of the dynamic texture. More...
 
int Height
 The height of the dynamic texture. More...
 
string Name
 The name for this texture. More...
 
bool Refreshing
 True if this texture needs a refresh this frame. More...
 
Color32[] Pixels
 The pixels of this texture. More...
 
int ResizedWidth
 The resized height of the texture (internal). Only used if this texture is resized and it gets shrunk. More...
 
int ResizedHeight
 The resized height of the texture (internal). Only used if this texture is resized and it gets shrunk. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from PowerUI.DynamicTexture
static DynamicTexture Get (string byName)
 Gets a dynamic texture by name from the global lookup. More...
 
static void RemoveAll ()
 Removes all dynamic textures. More...
 
static void Update ()
 Redraw requests are buffered and done in one go by this method. More...
 
- Static Public Attributes inherited from PowerUI.DynamicTexture
static bool SomethingToUpdate
 True if at least one dynamic texture must be flushed this frame. More...
 
static Dictionary< string,
DynamicTexture
Instances
 A global lookup of available dynamic textures used for mapping a URL to an object. E.g. background:url("dynamic://healthbar"); More...
 
- Properties inherited from PowerUI.DynamicTexture
FilterMode FilterMode [get, set]
 The filter mode of this dynamic texture. The default filtering is point. More...
 

Constructor & Destructor Documentation

HealthBar.HealthBar ( )
inline

Member Function Documentation

void HealthBar.DrawArc ( int  linesGreen)
inline

Draws the arched/curved section of the bar.

Parameters
linesGreenThe number of lines of the arc that should be coloured green.
void HealthBar.DrawHalfCircle ( int  x0,
int  y0,
int  linesGreen,
bool  leftwards 
)
inline

Draws a half of a circle to the image.

Parameters
x0The x location in pixels of the middle of the circle.
y0The y location in pixels of the middle of the circle.
linesGreenThe number of lines out of 5 that should be coloured green.
leftwardsTrue leftwards means that the greenness fills from right to left - it travels left.
override void HealthBar.Flush ( )
inlinevirtual

Writes the pixels out to the screen.

Reimplemented from PowerUI.DynamicTexture.

void HealthBar.IncreaseHealth ( float  delta)
inline

Increases (or decreases for a negative) the current value of the bar.

Parameters
deltaA value from 0->1 representing how much the bar should change by.
void HealthBar.SetHealth ( float  health)
inline

Sets the active value of this bar.

Parameters
healthA value from 0->1 indicating how full the bar is.

Member Data Documentation

int [] HealthBar.HalfCircleY =new int[]{5,4,4,3,1}

The y pixel coordinates using the array index as x to draw a quarter circle. The values are essentially mirrored over x to produce a half circle for the ends of the bar.

float HealthBar.Health =0f

The active value from 0->1 of this bar.

int [] HealthBar.InnerCircleSetX

The arc of the bar is drawn as a series of lines starting at an inner circle (inner edge of the bar) to the outer circle (outer edge). The following values represent the x and y coordinates of the start (inner) and end (outer) of these lines. They are computed by essentially rotating around the center of the circles.

int [] HealthBar.InnerCircleSetY
Color HealthBar.LitColour =Color.green

The colour of a full bar.

int [] HealthBar.OuterCircleSetX
int [] HealthBar.OuterCircleSetY
int HealthBar.PixelLines =0

The number of lines drawn to display the bar.

Color HealthBar.UnlitColour =Color.red

The colour of an empty bar.