public override void Shoot(Aim aim, EventArgs args) { var ratio = ((IWrapper <float>)args).Value; damage = Mathf.Lerp(damages.x, damages.y, ratio); actualSpeed = Mathf.Lerp(speed, maxSpeed, ratio); var size = Mathf.Lerp(range.x, range.y, ratio); sizeTarget.localScale = Vector3.one * range.x; if (routine != null) { StopCoroutine(routine); } var margin = new Vector2(range.x, size); routine = StartCoroutine(Routines.RepeatFor(time, ratio => { var scale = Mathf.Lerp(margin.x, margin.y, map.Evaluate(ratio)); sizeTarget.localScale = Vector3.one * scale; }, new YieldFrame()).Chain(Routines.Do(() => routine = null))); bounceCounter = bounceCount; deactivationTimer = deactivationTime; base.Shoot(aim, args); }
protected override EventArgs OnUpdate(Aim aim, EventArgs args) { progress = Mathf.Clamp(aim.pressTime, 0.0f, time); HUD.Set(progress / time); var ratio = Mathf.InverseLerp(threshold, time, progress); Events.ZipCall(PlayerEvent.OnShake, shakeFactor * ratio, maxShake); return(args); }
public override void End(Aim aim, EventArgs args) { if (progress < threshold) { progress = 0.0f; HUD.Set(0.0f); return; } base.End(aim, args); }
public virtual void End(Aim aim, EventArgs args) { var modifiedArgs = OnEnd(aim, args); foreach (var followingPart in followingParts) { if (!followingPart.IsActive) { continue; } followingPart.End(aim, modifiedArgs); } }
public override void Shoot(Aim aim, EventArgs args) { deactivationTimer = deactivationTime; hasHit = false; base.Shoot(aim, args); trail.enabled = true; routine = StartCoroutine(Routines.DoAfter(() => { graph.SetActive(true); routine = null; }, 0.15f)); }
protected override EventArgs OnUpdate(Aim aim, EventArgs args) { counter -= Time.deltaTime; if (counter <= 0) { counter = time + counter; foreach (var followingPart in FollowingParts) { if (!followingPart.IsActive) { continue; } followingPart.End(aim, args); } } return(args); }
protected override EventArgs OnEnd(Aim aim, EventArgs args) { animator.SetTrigger("Shoot"); var bulletPool = Repository.Get <GenericPool>(Pool.Bullet); var bulletInstance = bulletPool.CastSingle <Bullet>(bullet); bulletInstance.Shoot(aim, args); if (args is IWrapper <float> forceArgs) { Events.ZipCall(PlayerEvent.OnFire, Mathf.Lerp(force * 0.25f, force, forceArgs.Value)); } else { Events.ZipCall(PlayerEvent.OnFire, force); } return(args); }
protected override EventArgs OnEnd(Aim aim, EventArgs args) { var muzzleFlashPool = Repository.Get <VfxPool>(Pool.MuzzleFlash); var muzzleFlashInstance = muzzleFlashPool.RequestSinglePoolable(muzzleFlash); if (args is IWrapper <float> sizeWrapper) { muzzleFlashInstance.transform.localScale = Vector3.one * Mathf.Lerp(0.3f, 1.0f, sizeWrapper.Value); } else { muzzleFlashInstance.transform.localScale = Vector3.one; } muzzleFlashInstance.transform.parent = Control.Firepoint; muzzleFlashInstance.transform.position = aim.firepoint; muzzleFlashInstance.transform.rotation = Quaternion.LookRotation(aim.firingDirection); muzzleFlashInstance.Value.Play(); return(args); }
protected virtual EventArgs OnEnd(Aim aim, EventArgs args) => args;
protected virtual EventArgs OnUpdate(Aim aim, EventArgs args) => args;
protected virtual EventArgs OnStart(Aim aim, EventArgs args) => args;
public virtual void Shoot(Aim aim, EventArgs args) { transform.position = aim.firepoint; direction = aim.direction.normalized; }
protected override EventArgs OnEnd(Aim aim, EventArgs args) { Routines.Start(CooldownRoutine()); return(new WrapperArgs <float>(Mathf.InverseLerp(threshold, time, progress))); }
protected override EventArgs OnEnd(Aim aim, EventArgs args) { MoveControl.canShowWalk = true; return(args); }
public override void End(Aim aim, EventArgs args) { OnEnd(aim, args); return; }
protected override EventArgs OnStart(Aim aim, EventArgs args) { MoveControl.canShowWalk = false; return(args); }