convert game playing..
This commit is contained in:
@@ -9,6 +9,7 @@ namespace BumpCombat.Combat
|
||||
public sealed class ArtifactStatusVisual : MonoBehaviour
|
||||
{
|
||||
public const int StatusSortingOffset = 1;
|
||||
public const float StatusVisualAnchorOffsetY = -13f / 32f;
|
||||
|
||||
private const int FrameCount = 6;
|
||||
private const float PixelsPerUnit = 32f;
|
||||
@@ -213,14 +214,23 @@ namespace BumpCombat.Combat
|
||||
return;
|
||||
}
|
||||
|
||||
Vector2 groundAnchor = enemy.GroundAnchorPosition;
|
||||
slot.Root.transform.SetPositionAndRotation(
|
||||
new Vector3(groundAnchor.x, groundAnchor.y, transform.position.z),
|
||||
Quaternion.identity);
|
||||
Transform visualTransform = enemy.CurrentVisualTransform;
|
||||
if (slot.Root.transform.parent != visualTransform)
|
||||
{
|
||||
slot.Root.transform.SetParent(visualTransform, false);
|
||||
}
|
||||
|
||||
float anchorOffsetY = sourceRenderer.flipY
|
||||
? -StatusVisualAnchorOffsetY
|
||||
: StatusVisualAnchorOffsetY;
|
||||
slot.Root.transform.localPosition =
|
||||
new Vector3(0f, anchorOffsetY, 0f);
|
||||
slot.Root.transform.localRotation = Quaternion.identity;
|
||||
slot.Root.transform.localScale = Vector3.one;
|
||||
slot.Renderer.sortingLayerID = sourceRenderer.sortingLayerID;
|
||||
slot.Renderer.sortingOrder =
|
||||
sourceRenderer.sortingOrder + StatusSortingOffset;
|
||||
enemy.CurrentVisualSortingOrder + StatusSortingOffset;
|
||||
slot.Renderer.forceRenderingOff = sourceRenderer.forceRenderingOff;
|
||||
slot.Renderer.flipX = sourceRenderer.flipX;
|
||||
slot.Renderer.flipY = sourceRenderer.flipY;
|
||||
slot.Renderer.sharedMaterial = sourceRenderer.sharedMaterial;
|
||||
|
||||
@@ -3,6 +3,7 @@ using BumpCombat.Core;
|
||||
using BumpCombat.Constants;
|
||||
using BumpCombat.Enemies;
|
||||
using BumpCombat.Player;
|
||||
using BumpCombat.Progression;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BumpCombat.Combat
|
||||
@@ -12,6 +13,7 @@ namespace BumpCombat.Combat
|
||||
public sealed class BumpCombatResolver : MonoBehaviour
|
||||
{
|
||||
private float baseDamage => GameplayConstants.Current.Combat.BaseDamage;
|
||||
private bool enableFrontalBumpSelfDamage => GameplayConstants.Current.Combat.EnableFrontalBumpSelfDamage;
|
||||
private float dashDamage => GameplayConstants.Current.Combat.DashDamage;
|
||||
private float strongDashDamage => GameplayConstants.Current.Combat.StrongDashDamage;
|
||||
private float minimumAttackSpeed => GameplayConstants.Current.Combat.MinimumAttackSpeed;
|
||||
@@ -35,6 +37,7 @@ namespace BumpCombat.Combat
|
||||
private readonly Dictionary<int, float> nextNormalHitTimes = new();
|
||||
|
||||
private PlayerStats playerStats;
|
||||
private PlayerHealth playerHealth;
|
||||
private PlayerController playerController;
|
||||
private DashController dashController;
|
||||
private ActiveArtifactController activeArtifactController;
|
||||
@@ -43,6 +46,7 @@ namespace BumpCombat.Combat
|
||||
private void Awake()
|
||||
{
|
||||
playerStats = GetComponent<PlayerStats>();
|
||||
playerHealth = GetComponent<PlayerHealth>();
|
||||
playerController = GetComponent<PlayerController>();
|
||||
dashController = GetComponent<DashController>();
|
||||
activeArtifactController = GetComponent<ActiveArtifactController>();
|
||||
@@ -335,6 +339,10 @@ namespace BumpCombat.Combat
|
||||
playerStats.CalculateDamage(rawDamage, damageTag),
|
||||
side,
|
||||
isOffsetHit);
|
||||
finalDamage = PassiveRelicController.Instance?.ApplyOrdinaryBumpDamageMultiplier(
|
||||
finalDamage,
|
||||
!isDash && string.IsNullOrEmpty(sourceId),
|
||||
artifactColor.HasValue) ?? finalDamage;
|
||||
Vector2 knockbackDirection = -enemyToPlayer;
|
||||
bool suppressOrdinaryEventReaction = !isDash && isEventEnemy;
|
||||
float appliedKnockback = knockbackOverride
|
||||
@@ -361,7 +369,8 @@ namespace BumpCombat.Combat
|
||||
appliedKnockback,
|
||||
artifactColor.Value,
|
||||
castIdentity,
|
||||
!suppressOrdinaryEventReaction);
|
||||
!suppressOrdinaryEventReaction,
|
||||
EnemyDamageSource.Player);
|
||||
acceptedHit = artifactHitResult
|
||||
!= EnemyArtifactHitResult.Rejected;
|
||||
}
|
||||
@@ -372,7 +381,8 @@ namespace BumpCombat.Combat
|
||||
knockbackDirection,
|
||||
appliedKnockback,
|
||||
!suppressOrdinaryEventReaction,
|
||||
!isDash);
|
||||
!isDash,
|
||||
EnemyDamageSource.Player);
|
||||
}
|
||||
|
||||
if (!acceptedHit)
|
||||
@@ -477,16 +487,24 @@ namespace BumpCombat.Combat
|
||||
|
||||
if (!isDash && !protectionBegan)
|
||||
{
|
||||
if (!enemy.IsCrowd
|
||||
if (enableFrontalBumpSelfDamage
|
||||
&& !artifactColor.HasValue
|
||||
&& side == HitSide.Front)
|
||||
{
|
||||
playerHealth?.TryTakeDamage(
|
||||
enemy.ContactDamage,
|
||||
enemyToPlayer,
|
||||
enemy.PlayerKnockbackDistance);
|
||||
}
|
||||
else if (side != HitSide.Front
|
||||
&& !enemy.IsCrowd
|
||||
&& BumpCombatMath.AppliesPlayerImpactRecoil(side, isEventEnemy))
|
||||
{
|
||||
playerController.ApplyImpactRecoil(
|
||||
enemyToPlayer,
|
||||
side == HitSide.Front
|
||||
? frontPlayerImpactRecoilDistance
|
||||
: side == HitSide.Back && isEventEnemy
|
||||
? eventBackPlayerImpactRecoilDistance
|
||||
: playerImpactRecoilDistance);
|
||||
side == HitSide.Back && isEventEnemy
|
||||
? eventBackPlayerImpactRecoilDistance
|
||||
: playerImpactRecoilDistance);
|
||||
}
|
||||
activeArtifactController?.AddNormalHitCharge();
|
||||
}
|
||||
|
||||
@@ -27,6 +27,9 @@ namespace BumpCombat.Combat
|
||||
private float cameraShakeDuration => GameplayConstants.Current.CombatFeedback.CameraShakeDuration;
|
||||
private float cameraShakePixels => GameplayConstants.Current.CombatFeedback.CameraShakePixels;
|
||||
private float heavyCameraShakePixels => GameplayConstants.Current.CombatFeedback.HeavyCameraShakePixels;
|
||||
private float rearHitCameraPunchDuration => GameplayConstants.Current.CombatFeedback.RearHitCameraPunchDuration;
|
||||
private float rearHitCameraPunchPixels => GameplayConstants.Current.CombatFeedback.RearHitCameraPunchPixels;
|
||||
private float rearHitCameraPunchRearmDelay => GameplayConstants.Current.CombatFeedback.RearHitCameraPunchRearmDelay;
|
||||
private float heavyKnockbackThreshold => GameplayConstants.Current.CombatFeedback.HeavyKnockbackThreshold;
|
||||
[SerializeField, Min(1f)] private float assetsPixelsPerUnit = 32f;
|
||||
|
||||
@@ -96,6 +99,7 @@ namespace BumpCombat.Combat
|
||||
private float flashUntil;
|
||||
private float blinkUntil;
|
||||
private Vector3 cameraRestPosition;
|
||||
private float lastRearHitCameraPunchAt = float.NegativeInfinity;
|
||||
private Material effectMaterial;
|
||||
private Vector3 lastCycloneSamplePosition;
|
||||
private Vector2 lastDashAfterimagePosition;
|
||||
@@ -309,6 +313,7 @@ namespace BumpCombat.Combat
|
||||
private void OnEnable()
|
||||
{
|
||||
activeInstance = this;
|
||||
lastRearHitCameraPunchAt = float.NegativeInfinity;
|
||||
CombatEvents.OnValidHit += HandleValidHit;
|
||||
CombatEvents.OnStunApplied += HandleStunApplied;
|
||||
CombatEvents.OnAttackCancelled += HandleAttackCancelled;
|
||||
@@ -1354,6 +1359,19 @@ namespace BumpCombat.Combat
|
||||
return;
|
||||
}
|
||||
|
||||
if (result.IsOrdinaryBump && result.HasBackBonus)
|
||||
{
|
||||
float now = Time.time;
|
||||
bool rearHitCameraPunchRearmed =
|
||||
now - lastRearHitCameraPunchAt >= rearHitCameraPunchRearmDelay;
|
||||
lastRearHitCameraPunchAt = now;
|
||||
|
||||
if (rearHitCameraPunchRearmed)
|
||||
{
|
||||
RequestRearHitCameraPunch(result.KnockbackDirection);
|
||||
}
|
||||
}
|
||||
|
||||
Color color;
|
||||
float strength;
|
||||
int rayCount;
|
||||
@@ -2203,6 +2221,63 @@ namespace BumpCombat.Combat
|
||||
playerVisualCoroutine = null;
|
||||
}
|
||||
|
||||
private void RequestRearHitCameraPunch(Vector2 direction)
|
||||
{
|
||||
if (worldCamera == null ||
|
||||
rearHitCameraPunchDuration <= 0f ||
|
||||
rearHitCameraPunchPixels <= 0f ||
|
||||
rearHitCameraPunchRearmDelay < 0f ||
|
||||
assetsPixelsPerUnit <= 0f ||
|
||||
direction.sqrMagnitude <= Mathf.Epsilon ||
|
||||
cameraShakeCoroutine != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cameraRestPosition = worldCamera.transform.position;
|
||||
cameraShakeCoroutine = StartCoroutine(
|
||||
RearHitCameraPunchRoutine(direction.normalized));
|
||||
}
|
||||
|
||||
private IEnumerator RearHitCameraPunchRoutine(Vector2 normalizedDirection)
|
||||
{
|
||||
float startTime = Time.unscaledTime;
|
||||
|
||||
while (Time.unscaledTime - startTime < rearHitCameraPunchDuration)
|
||||
{
|
||||
float t =
|
||||
(Time.unscaledTime - startTime) / rearHitCameraPunchDuration;
|
||||
Vector2 pixelOffset =
|
||||
normalizedDirection * (rearHitCameraPunchPixels * (1f - t));
|
||||
Vector2 offset = new Vector2(
|
||||
Mathf.Round(pixelOffset.x) / assetsPixelsPerUnit,
|
||||
Mathf.Round(pixelOffset.y) / assetsPixelsPerUnit);
|
||||
|
||||
if (cameraFollow != null)
|
||||
{
|
||||
cameraFollow.SetExternalShakeOffset(offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldCamera.transform.position =
|
||||
cameraRestPosition + new Vector3(offset.x, offset.y, 0f);
|
||||
}
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
if (cameraFollow != null)
|
||||
{
|
||||
cameraFollow.SetExternalShakeOffset(Vector2.zero);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldCamera.transform.position = cameraRestPosition;
|
||||
}
|
||||
|
||||
cameraShakeCoroutine = null;
|
||||
}
|
||||
|
||||
private void RequestCameraShake(float pixels)
|
||||
{
|
||||
if (worldCamera == null || pixels <= 0f || cameraShakeDuration <= 0f)
|
||||
|
||||
Reference in New Issue
Block a user