void IGameEvent.Invoke(Actor invokedActor) { Broker.Global.Publish(RequestChangeStage.Get(this.prefab)); invokedActor.Movement.Warp(this.actorPosition); this.ClearGameEvent(invokedActor); }
void IActorReactionOnTriggerEnter2D.Do(Actor actor) { if (!this.includeTags.Contains(actor.tag)) { return; } Broker.Global.Receive <EndFadeIn>() .Take(1) .SubscribeWithState2(this, actor, (_, _this, _actor) => { Broker.Global.Publish(RequestChangeStage.Get(_this.prefab)); _actor.Movement.Warp(_this.actorPosition); Broker.Global.Publish(RequestFadeOut.Get(_this.direction.ToReverse().ToFadeType(), _this.fadeTimeSeconds)); Broker.Global.Publish(EndChangeStage.Get()); }); Broker.Global.Publish(BeginChangeStage.Get()); Broker.Global.Publish(RequestFadeIn.Get(this.direction.ToFadeType(), this.fadeTimeSeconds)); actor.UpdateAsObservable() .TakeUntil(Broker.Global.Receive <EndChangeStage>()) .SubscribeWithState2(this, actor, (_, _this, _actor) => { _actor.Broker.Publish(RequestMove.Get(_this.direction.ToVector2())); }) .AddTo(actor); }
void Start() { Broker.Global.Publish(RequestChangeStage.Get(this.prefab)); }