Class PropertiesSample
This class manages the scene for showcasing the Properties system.
Inherited Members
Namespace: UnityEngine.GameFoundation.Sample
Syntax
public class PropertiesSample : MonoBehaviour
Fields
healButton
Declaration
public Button healButton
Field Value
Type | Description |
---|---|
Button |
mainText
We will need a reference to the main text box in the scene so we can easily modify it.
Declaration
public Text mainText
Field Value
Type | Description |
---|---|
Text |
takeDamageButton
References to the specific buy/sell buttons to enable/disable when either action is not possible.
Declaration
public Button takeDamageButton
Field Value
Type | Description |
---|---|
Button |
Methods
Heal()
Increases the player's health by the health restore property of a health potion, then removes it. This only happens if there is at least one health potion in the inventory, and if the player's health is not maxed out.
Declaration
public void Heal()
OnGameFoundationException(Exception)
If GameFoundation throws exception, log the error to console.
Declaration
public void OnGameFoundationException(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | Exception thrown by GameFoundation. |
OnGameFoundationInitialized()
Once Game Foundation completes initialization, we enable buttons, setup callbacks, update GUI, etc.
Declaration
public void OnGameFoundationInitialized()
TakeDamage()
Apply the sword's damage value to the player's health.
Declaration
public void TakeDamage()