Implement passive relics and six-family defense towers

This commit is contained in:
2026-09-23 18:11:38 +09:00
parent 5d11288a6f
commit c94cbda1e6
21 changed files with 2882 additions and 152 deletions
@@ -2,6 +2,7 @@ using UnityEngine;
using UnityEngine.InputSystem;
using BumpCombat.Core;
using BumpCombat.Constants;
using BumpCombat.Progression;
namespace BumpCombat.Player
{
@@ -33,12 +34,17 @@ namespace BumpCombat.Player
private DashController dashController;
private ActiveArtifactController activeArtifactController;
private PlayerHealth playerHealth;
private PassiveRelicController passiveRelics;
private Vector2 moveInput;
private Vector2 pendingImpactRecoil;
private Vector2 damageKnockbackDirection;
private float damageKnockbackDistance;
private float damageKnockbackDuration;
private float damageKnockbackElapsed;
private Vector2 voluntaryMovementStart;
private bool voluntaryMovementPending;
public void SetPassiveRelicController(PassiveRelicController relics) => passiveRelics = relics;
public Vector2 MoveDirection { get; private set; }
public Vector2 FacingDirection { get; private set; } = Vector2.right;
@@ -72,6 +78,7 @@ namespace BumpCombat.Player
dashController = GetComponent<DashController>();
activeArtifactController = GetComponent<ActiveArtifactController>();
playerHealth = GetComponent<PlayerHealth>();
passiveRelics = GetComponent<PassiveRelicController>();
}
private void OnDisable()
@@ -191,6 +198,16 @@ namespace BumpCombat.Player
private void FixedUpdate()
{
if (voluntaryMovementPending
&& body != null
&& !IsTransitionLocked
&& !IsDamageKnockbackActive
&& (dashController == null || !dashController.IsDashing))
{
passiveRelics?.AddVoluntaryMovement(
Vector2.Distance(voluntaryMovementStart, body.position));
}
voluntaryMovementPending = false;
AttackIntentVelocity = Vector2.zero;
if (IsTransitionLocked)
{
@@ -244,6 +261,8 @@ namespace BumpCombat.Player
startPosition + AttackIntentVelocity * Time.fixedDeltaTime);
body.MovePosition(targetPosition);
voluntaryMovementStart = startPosition;
voluntaryMovementPending = targetPosition != startPosition;
CurrentVelocity = (targetPosition - startPosition) / Time.fixedDeltaTime;
if (CurrentVelocity.sqrMagnitude > 0.0001f)
{
@@ -332,6 +351,7 @@ namespace BumpCombat.Player
pendingImpactRecoil = Vector2.zero;
IsDamageKnockbackActive = false;
body.linearVelocity = Vector2.zero;
voluntaryMovementPending = false;
body.position = ClampToArena(position);
transform.position = body.position;
return true;