Пример #1
0
    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;
    }
Пример #2
0
    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;
    }