Energy Based Objects  2.01
Public Member Functions | Public Attributes | Properties | Events
Energy Class Reference

Holds energy and automatically regains/drains energy overtime. More...

List of all members.

Public Member Functions

void ResetModifyDelay ()
 Resets the timer for when the modifier should be applied.
float TakeEnergy (float amount)
 Takes the amount of energy if not at minAmount.

Public Attributes

float minAmount
 The amount of energy should not go below this amount.
float maxAmount = 10
 The amount of energy should not go above this amount.
bool multiplyDeltaTime = true
 Multiply Time.deltaTime to the modifierAmount when modifying the amount. It effectively turns the modifierAmount into seconds so it won't be frame-dependant.
float modifierAmount = 1
 The amount of energy will be changed by this amount. Useful for automatically adding/subtracting energy.
float modifyDelayAmount = 1
 The delay before the amount of energy begins modifying. Used when the energy amount property is changed.
float modifyTime
 The time left until the amount will be modified again.

Properties

float amount [get, set]
 Amount of energy.
float positiveAmount [get]
 Get how much positive energy there is. This value is offset by the minAmount to give the total available amount.
float negativeAmount [get]
 *Test* Get how much negative energy there is. This value is offset by the maxAmount to give the total available amount.

Events

Action< Energy, float > OnModifiedEnergy
 Called when energy is automatically modified in Update float is the amount changed.
Action< Energy, float > OnMinEnergy
 Called when energy automatically reaches minAmount float is the amount changed.
Action< Energy, float > OnMaxEnergy
 Called when energy automatically reaches maxAmount float is the amount changed.

Detailed Description

Holds energy and automatically regains/drains energy overtime.


Member Function Documentation

void ResetModifyDelay ( )

Resets the timer for when the modifier should be applied.

float TakeEnergy ( float  amount)

Takes the amount of energy if not at minAmount.

Parameters:
amount
Returns:
Amount left after the energy was taken

Member Data Documentation

float maxAmount = 10

The amount of energy should not go above this amount.

float minAmount

The amount of energy should not go below this amount.

float modifierAmount = 1

The amount of energy will be changed by this amount. Useful for automatically adding/subtracting energy.

float modifyDelayAmount = 1

The delay before the amount of energy begins modifying. Used when the energy amount property is changed.

float modifyTime

The time left until the amount will be modified again.

bool multiplyDeltaTime = true

Multiply Time.deltaTime to the modifierAmount when modifying the amount. It effectively turns the modifierAmount into seconds so it won't be frame-dependant.


Property Documentation

float amount [get, set]

Amount of energy.

float negativeAmount [get]

*Test* Get how much negative energy there is. This value is offset by the maxAmount to give the total available amount.

So if you're maxAmount is -1 and your amount is -5, you would really have -4 energy.

float positiveAmount [get]

Get how much positive energy there is. This value is offset by the minAmount to give the total available amount.

So if you're minAmount is 1 and your amount is 10, you would really have 9 energy.


Event Documentation

Action<Energy, float> OnMaxEnergy

Called when energy automatically reaches maxAmount float is the amount changed.

Action<Energy, float> OnMinEnergy

Called when energy automatically reaches minAmount float is the amount changed.

Action<Energy, float> OnModifiedEnergy

Called when energy is automatically modified in Update float is the amount changed.

 All Classes Namespaces Functions Variables Properties Events