/// <summary> /// Sets the type of hit result this item should represent. /// </summary> public void SetResultType(HitResultType type) { var color = ColorPreset.GetHitResultColor(type); baseSprite.Color = color; bgSprite.Color = color.Alpha(0.25f); }
public void TestMiss() { HitResultType type = testShot(2, 2); Assert.IsTrue(type == HitResultType.Hit); hitResult = null; }
public void TestHit() { HitResultType type = testShot(0, 0); Assert.IsTrue(type == HitResultType.Hit); hitResult = null; }
public int GetHitCount(HitResultType result) { if (HitResultCounts.TryGetValue(result, out int count)) { return(count); } return(0); }
public override float GetHealthBonus(HitResultType result) { switch (result) { case HitResultType.Perfect: return(0.25f); } return(0f); }
public ColorPalette GetHitResultColor(HitResultType type) { if (hitResultColors.TryGetValue(type, out ColorPalette value)) { return(value); } Logger.LogWarning($"ColorPreset.GetHitResultColor - Unknown type: {type}"); return(new ColorPalette(Color.white)); }
public override int GetNumericResult(HitResultType result) { switch (result) { case HitResultType.Perfect: case HitResultType.Great: case HitResultType.Good: return(20); } return(0); }
public override JudgementResult SetResult(HitResultType hitResult, float offset) { var judgement = base.SetResult(hitResult, offset); Active = true; if (hitAni.IsPlaying) { hitAni.Stop(); } return(judgement); }
public void PlayEffect(HitResultType type) { ChangeText(type.ToString()); if (playingEffect) { StopCoroutine(effectCol); } effectCol = StartCoroutine(PlayEffect(effectDuration, ((int)type * 2 + 11) / 10f, maxScale * ((int)type * 2 + 11) / 10f)); RotateInTheMoment(Random.Range(0, 15f) * -1); }
/// <summary> /// Returns the timing value for the lowest possible successful hit. /// </summary> protected HitResultType LowestSuccessfulHitResult() { HitResultType lastResult = HitResultType.None; foreach (var result in SupportedHitResults()) { if (result != HitResultType.Miss) { lastResult = result; } } return(lastResult); }
/// <summary> /// Event called on new input-triggerd judgement. /// </summary> protected virtual void OnInputResult(JudgementResult result) { HitResultType type = result.HitResult; if (type == HitResultType.Miss) { return; } // Show a pulse effect at the current position. var effect = PulseRecycler.GetNext(); effect.Show(myTransform.position, ColorPreset.GetHitResultColor(type)); }
public override JudgementResult SetResult(HitResultType hitResult, float offset) { var judgement = base.SetResult(hitResult, offset); if (judgement.IsHit) { hitAni.PlayFromStart(); } else { Active = false; } return(judgement); }
private void OnCollisionEnter2D(Collision2D collision) { IHittable hittable = collision.collider.attachedRigidbody.gameObject.GetComponent <IHittable>(); if (hittable != null) { HitResultType resultType = hittable.Hit(gameObject); if (resultType == HitResultType.DESTROY) { HideBullet(); } else if (resultType == HitResultType.RICOCHET) { Ricochet(collision); } } }
/// <summary> /// Returns the halved value of the timing value for specified result. /// </summary> public float GetHalfTiming(HitResultType type) { switch (type) { case HitResultType.Perfect: return(Perfect / 2); case HitResultType.Great: return(Great / 2); case HitResultType.Good: return(Good / 2); case HitResultType.Ok: return(Ok / 2); case HitResultType.Bad: return(Bad / 2); case HitResultType.Miss: return(Miss / 2); } Logger.LogWarning($"HitTiming.GetHalfTiming - Unsupported hit result type: {type}"); return(0); }
/// <summary> /// Returns the amount of numeric value the specified hit result type accounts for. /// </summary> public virtual int GetNumericResult(HitResultType result) { return(0); }
/// <summary> /// Returns the amount of scale to boost health increase for specified hit result type. /// </summary> public virtual float GetHealthBonus(HitResultType result) { return(0); }
public override JudgementResult SetResult(HitResultType hitResult, float offset) { base.SetResult(hitResult, offset); PlayArea.HitBar.ShowJudgementEffect(GetPosOnJudgement(), this); return(Result); }
public void PlayHitEffect(HitResultType type) { hitResultEffect.PlayEffect(type); }
/// <summary> /// Returns whether the specified hit result type is valid in current ruleset. /// </summary> public bool IsSupportedHitType(HitResultType type) { return(hitTiming?.IsHitResultSupported(type) ?? false); }
/// <summary> /// Returns whether specified hit result is supported. /// </summary> public virtual bool IsHitResultSupported(HitResultType result) { return(SupportedHitResults().Any(r => r == result)); }
public void PlayHitEffect(HitResultType type) { targetEffect.PlayHitEffect(type); }