Example #1
0
    void Update()
    {
        if (!focusNode.Focused)
        {
            return;
        }

        dpImage.transform.Rotate(Vector3.forward * rotateSpeed * Time.deltaTime);
        if (input.GetButtonDown(ButtonCode.Enter))
        {
            _Pushed.OnNext(Unit.Default);
        }
    }
Example #2
0
    public override HeroState HandleInput(HeroMover hero, IInput input)
    {
        if (hero.IsReady2Kick2Left(input))
        {
            return(new StateKick(toRight: false));
        }
        if (hero.IsReady2Kick2Right(input))
        {
            return(new StateKick(toRight: true));
        }

        if (hero.CanJumpInAir && input.GetButtonDown(ButtonCode.Jump))
        {
            return(new StateJump(fromGround: false));
        }

        SetDir(CalcDir(hero), hero);

        return(this);
    }
Example #3
0
    public override HeroState HandleInput(HeroMover hero, IInput input)
    {
        if (input.GetButtonDown(ButtonCode.Jump))
        {
            return(new StateJump());
        }
        if (!(input.GetButton(ButtonCode.Right) || input.GetButton(ButtonCode.Left)))
        {
            return(new StateWait());
        }

        if (hero.KeyDirection == 1 && !right)
        {
            right = true;
            hero.SetAnim("run");
        }
        if (hero.KeyDirection == -1 && right)
        {
            right = false;
            hero.SetAnim("run");
        }

        return(this);
    }
Example #4
0
 public bool SelectButtonDown() => input.GetButtonDown(ButtonCode.Enter);
Example #5
0
    void Update()
    {
        switch (state)
        {
        case State.Inactive:
        {
            if (hero.CanMove && input.GetButtonDown(ButtonCode.Jet))
            {
                state = State.Ready;
                EffectOnReady();
            }
        }
        break;

        case State.Ready:
        {
            if (!hero.CanMove)
            {
                state = State.Inactive;
                break;
            }

            chargeSeconds += hero.TimeManager.DeltaTimeAroundHero;

            if (input.GetButtonUp(ButtonCode.Jet))
            {
                state = State.Jetting;

                JetParams params_    = hero.Parameters.JetParams;
                float     charge_0_1 = Mathf.Clamp01(
                    Mathf.InverseLerp
                    (
                        params_.ChargeSecondsFromMin * params_.TimeScaleBeforeJet,
                        params_.ChargeSecondsToMax * params_.TimeScaleBeforeJet,
                        chargeSeconds
                    )
                    );
                hero.Jet(charge_0_1)
                .Subscribe(_ =>
                    {
                        coolTimeLeft = hero.Parameters.JetParams.CoolTime;
                        state        = State.CoolTime;
                        EffectOnExit();
                        _JetEnded.OnNext(Unit.Default);
                    });

                EffectOnJet();

                chargeSeconds = 0;
            }
        }
        break;

        case State.Jetting:
        {
            //
        }
        break;

        case State.CoolTime:
        {
            coolTimeLeft -= hero.TimeManager.DeltaTimeAroundHero;
            if (coolTimeLeft <= 0)
            {
                state = State.Inactive;
            }
        }
        break;
        }
    }