mirror of
https://github.com/RaindropViewer/RaindropViewer.git
synced 2026-07-27 16:08:08 +00:00
17 lines
446 B
C#
17 lines
446 B
C#
|
|
// The Model. All property notify when their values change
|
|
using UniRx;
|
|
|
|
public class Enemy
|
|
{
|
|
public ReactiveProperty<long> CurrentHp { get; private set; }
|
|
|
|
public IReadOnlyReactiveProperty<bool> IsDead { get; private set; }
|
|
|
|
public Enemy(int initialHp)
|
|
{
|
|
// Declarative Property
|
|
CurrentHp = new ReactiveProperty<long>((long)initialHp);
|
|
IsDead = CurrentHp.Select(x => x <= 0).ToReactiveProperty();
|
|
}
|
|
} |