public override void Enter(HeroMover hero) { hero.MutekiManager.AddMutekiFilter("Jet"); hero.CanMove = false; hero.SetAnim("fall"); PhantomAndDissolve(hero); GameObject.Instantiate(hero.ObjsHolderForStates.JetstreamPrefab, DraftManager.CurrentInstance.GameMasterTF) .Init(hero); hero.GetDPinEnemy.GetComponent <Collider2D>().enabled = true; JetParams params_ = hero.Parameters.JetParams; float jetSeconds = Mathf.Lerp( params_.JetSecondsMin, params_.JetSecondsMax, charge_0_1 ); float jetDistance = Mathf.Lerp( params_.MinDistance, params_.MaxDistance, charge_0_1 ); hTween = new HeroTween( hero.WantsToGoRight ? jetDistance : -jetDistance, jetSeconds, hero.Parameters.JetParams.TweenLinearRate ); }
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; } }