Refactor treasure scriptable objects; update references and remove unused assets

This commit is contained in:
2026-06-20 19:59:03 +03:00
parent a510443130
commit 374d75d379
9 changed files with 18 additions and 59 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ public class NoiseSystem : MonoBehaviour
public static NoiseSystem Instance { get; private set; }
[SerializeField] private bool _debugMode = false;
[SerializeField] private LayerMask _enemyLayer = LayerMask.GetMask("Enemy");
[SerializeField] private LayerMask _enemyLayer;
public event EventHandler<NoiseEventArgs> OnNoiseEmitted;
+15
View File
@@ -12,11 +12,17 @@ public class HammerThrower : MonoBehaviour
private bool _hasHammer = true;
private bool _facingRight = true;
private float _cooldownTimer = 0f;
private Collider2D _playerCollider;
public bool HasHammer => _hasHammer;
public bool CanThrow => _hasHammer && _cooldownTimer <= 0f;
public float CooldownRemaining => Mathf.Max(0f, _cooldownTimer);
private void Awake()
{
_playerCollider = GetComponent<Collider2D>() ?? GetComponentInChildren<Collider2D>();
}
public void SetFacingDirection(bool facingRight)
{
_facingRight = facingRight;
@@ -38,6 +44,15 @@ public class HammerThrower : MonoBehaviour
_currentHammer = Instantiate(_hammerPrefab, _spawnPoint.position, _spawnPoint.rotation);
if (_playerCollider != null)
{
var hammerCollider = _currentHammer.GetComponent<Collider2D>();
if (hammerCollider != null)
{
Physics2D.IgnoreCollision(_playerCollider, hammerCollider);
}
}
// Initialize hammer with direction and speed
var hammerComponent = _currentHammer.GetComponent<Hammer>();
if (hammerComponent != null)
+1 -1
View File
@@ -47,7 +47,7 @@ public abstract class Character : MonoBehaviour
protected void MoveTo(float inputHorizontal, float inputVertical)
{
var block = GetMapElement();
var block = GetMapElement();
if (block?.ElementSO.ElementType == MapElementType.Water)
{