Version 1.5 of Energy Bar Toolkit introduces new feature called Event System. You can use it to quickly setup on what condition energy bar value changes during the game. In order to do so just drag SimpleEvent script into game object that has Collider attached and then configure it to your needs.
You can create:
- monsters or traps that drain health by contact with player
- health kits that restore health or mana
- instant kill zones
- poison zones that drain energy over time
- coins that add experience points
Description
- Energy Bar – Energy bar that will be affected by this event
- Trigger With – With what objects event (collision) should be triggered
- Tags – Tag list of trigger objects
- GameObjects – Examples of trigger objects
OnTriggerEnter, OnTriggerStay, OnTriggerLeave
You can set up behaviour for each of these triggers. Configuration is pretty much the same.
- Change Bar – Enable this to change energy bar value on this event
- Change Method – How to change the value
- IncreaseByValue – Increases energy bar by selected integer value.
- IncreaseByPercent – Increases energy bar by selected percentage value (0.0 – 1.0).
- DecreaseByValue – Decreases energy bar by selected integer value.
- DecreaseByPercent – Decreases energy bar by selected percentage value (0.0 – 1.0).
- SetToValue – Sets energy bar to selected integer value.
- SetToPercent – Sets energy bar to selected percentage value (0.0 – 1.0).
- Value – Value to change or set.
- Send Message – Enable to send message on this event using Unity SendMessage() function.
- Receiver Type – Who will receive this message.
- Self – Current game object.
- Collider – Object that will collide with this game object.
- FixedGameObject – Instance of other game object on the scene.
- Method Argument – You can choose what argument should be sent to message receiver.
- Caller – Will pass this game object. Method signature: OnMessage(GameObject caller)
- BarValue – Will pass integer bar value. Method signature: OnMessage(int val)
- BarValuePercent – Will pass percentage bar value (0.0 – 1.0). Method signature: OnMessage(float val)