コード例 #1
0
        public override void Enter(Actor owner, ActorAIController ownerAI)
        {
            base.Enter(owner, ownerAI);

            this.GetObserver(owner)
            .SubscribeWithState2(this, owner, (_, _this, _owner) =>
            {
                _owner.Broker.Publish(RequestJump.Get());
            })
            .AddTo(this.events);
        }
コード例 #2
0
        void IControllableUserInput.UpdateInput()
        {
            if (this.actor == null)
            {
                return;
            }

            var velocity = new Vector2(Input.GetAxis("Horizontal"), 0.0f);

            if (velocity.sqrMagnitude > 0.0f)
            {
                this.actor.Broker.Publish(RequestMove.Get(velocity));
            }

            var vertical = Input.GetAxis("Vertical");

            if (vertical < 0.0f)
            {
                this.actor.Broker.Publish(RequestFallOneWayPlatforms.Get());
            }

            if (Input.GetButtonDown("InvokeGameEvent"))
            {
                this.actor.Broker.Publish(RequestInvokeGameEvent.Get());
            }

            if (Input.GetButtonDown("Jump"))
            {
                this.actor.Broker.Publish(RequestJump.Get());
            }

            this.PublishRequestFire(InputName.Fire1, 0);
            this.PublishRequestFire(InputName.Fire2, 1);
            this.PublishRequestFire(InputName.Fire3, 2);

            this.PublishRequestTerminationFire(InputName.Fire1, 0);
            this.PublishRequestTerminationFire(InputName.Fire2, 1);
            this.PublishRequestTerminationFire(InputName.Fire3, 2);
        }