public virtual void CreateSkeleton(SkeletonContainer container) { model = new SkeletonModel(container); model.currentHealth.ObserveEveryValueChanged(x => x.Value) .Subscribe(hp => view.SetHP((float)hp / (float)model.maxHealth.Value * 100)) .AddTo(disposables); model.isDead.Where(isDead => isDead == true) .Subscribe(_ => { Death(); }).AddTo(disposables); view.trigger .OnTriggerEnter2DAsObservable() .Subscribe(x => TriggerEnter(x.gameObject)) .AddTo(disposables); Observable.EveryUpdate() .Subscribe(_ => StatesUpdate()) .AddTo(disposables); state = State.Walk; }
public override void InitState() { skeletonModel = GameManager.instance.skeletonModel; base.health = skeletonModel.health; base.initialHealth = skeletonModel.health; base.drops = skeletonModel.drops; base.dropChances = skeletonModel.randomDropPercentatges; GetComponent <SkeletonPatrol>().enabled = true; }