private void Start() { playerRigidBody = playerMover.GetComponentInParent <Rigidbody2D>(); this.FixedUpdateAsObservable() .WithLatestFrom(stateStore.State, (_, x) => x) .Where(x => x == State.Dead) .Subscribe(_ => { SinkPlayer(); MakePlayerResurrectable(); }) .AddTo(this); }
private void Start() { playerRigidBody = playerMover.GetComponentInParent <Rigidbody2D>(); stateStore.State .Where(x => x == State.Entering) .Subscribe(_ => { playerMover.enabled = true; playerRigidBody.position = initalPlayerPosition; playerRigidBody.rotation = 0; stateStore.State.Value = State.Waiting; }) .AddTo(this); }