Table of Contents

Class TestCharacterReactive

Namespace
GrindFest
Assembly
GrindFest.dll

Test component that exercises the OneJS (v3) reactive contract with game-like properties.

Each backing field has a public property and an OnXChanged event, which is what TSX binds to with useEventSync(obj, 'Strength') (it calls obj.add_OnStrengthChanged and re-reads obj.Strength). The one exception is HealthPercent: a calculated property has no setter to hang an event on, so it only updates when its inputs do.

public class TestCharacterReactive : MonoBehaviour
Inheritance
object
TestCharacterReactive

Properties

CharacterName

Reactive view of _characterName; raises OnCharacterNameChanged when the value actually changes.

Dexterity

Reactive view of _dexterity; raises OnDexterityChanged when the value actually changes.

Health

Reactive view of _health; raises OnHealthChanged when the value actually changes.

HealthPercent
Intelligence

Reactive view of _intelligence; raises OnIntelligenceChanged when the value actually changes.

Level

Reactive view of _level; raises OnLevelChanged when the value actually changes.

MaxHealth

Reactive view of _maxHealth; raises OnMaxHealthChanged when the value actually changes.

Strength

Reactive view of _strength; raises OnStrengthChanged when the value actually changes.

Methods

Heal(float)
IncreaseDexterity(int)
IncreaseIntelligence(int)
IncreaseStrength(int)
TakeDamage(float)

Events

OnCharacterNameChanged
OnDexterityChanged
OnHealthChanged
OnIntelligenceChanged
OnLevelChanged
OnMaxHealthChanged
OnStrengthChanged