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
@@ -300,7 +300,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
animator: {fileID: 7277787345195142390} animator: {fileID: 7277787345195142390}
_treasureSO: {fileID: 11400000, guid: d40fd30a10b87f9438f7ac341613dfa2, type: 2} _treasureSO: {fileID: 11400000, guid: 1f2fcda5f0230034eba2b2cfd9d40897, type: 2}
--- !u!95 &7277787345195142390 --- !u!95 &7277787345195142390
Animator: Animator:
serializedVersion: 7 serializedVersion: 7
-8
View File
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: ad356843f4c7ac7459d06943f0ece1a5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,16 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81dec0bb25670ad4db25ef9ce940b721, type: 3}
m_Name: Coin
m_EditorClassIdentifier: Assembly-CSharp::TreasureSO
Image: {fileID: 8331088274507185253, guid: fb6dbbc81180d204bb4ff36aae48fbc9, type: 3}
Treasure: 0
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: eabbfa3560e70f942a5ae19872153053
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
-16
View File
@@ -1,16 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81dec0bb25670ad4db25ef9ce940b721, type: 3}
m_Name: Key
m_EditorClassIdentifier: Assembly-CSharp::TreasureSO
Image: {fileID: 7818119699687691340, guid: fb6dbbc81180d204bb4ff36aae48fbc9, type: 3}
Treasure: 1
@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: d40fd30a10b87f9438f7ac341613dfa2
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
+1 -1
View File
@@ -6,7 +6,7 @@ public class NoiseSystem : MonoBehaviour
public static NoiseSystem Instance { get; private set; } public static NoiseSystem Instance { get; private set; }
[SerializeField] private bool _debugMode = false; [SerializeField] private bool _debugMode = false;
[SerializeField] private LayerMask _enemyLayer = LayerMask.GetMask("Enemy"); [SerializeField] private LayerMask _enemyLayer;
public event EventHandler<NoiseEventArgs> OnNoiseEmitted; public event EventHandler<NoiseEventArgs> OnNoiseEmitted;
+15
View File
@@ -12,11 +12,17 @@ public class HammerThrower : MonoBehaviour
private bool _hasHammer = true; private bool _hasHammer = true;
private bool _facingRight = true; private bool _facingRight = true;
private float _cooldownTimer = 0f; private float _cooldownTimer = 0f;
private Collider2D _playerCollider;
public bool HasHammer => _hasHammer; public bool HasHammer => _hasHammer;
public bool CanThrow => _hasHammer && _cooldownTimer <= 0f; public bool CanThrow => _hasHammer && _cooldownTimer <= 0f;
public float CooldownRemaining => Mathf.Max(0f, _cooldownTimer); public float CooldownRemaining => Mathf.Max(0f, _cooldownTimer);
private void Awake()
{
_playerCollider = GetComponent<Collider2D>() ?? GetComponentInChildren<Collider2D>();
}
public void SetFacingDirection(bool facingRight) public void SetFacingDirection(bool facingRight)
{ {
_facingRight = facingRight; _facingRight = facingRight;
@@ -38,6 +44,15 @@ public class HammerThrower : MonoBehaviour
_currentHammer = Instantiate(_hammerPrefab, _spawnPoint.position, _spawnPoint.rotation); _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 // Initialize hammer with direction and speed
var hammerComponent = _currentHammer.GetComponent<Hammer>(); var hammerComponent = _currentHammer.GetComponent<Hammer>();
if (hammerComponent != null) if (hammerComponent != null)
+1 -1
View File
@@ -47,7 +47,7 @@ public abstract class Character : MonoBehaviour
protected void MoveTo(float inputHorizontal, float inputVertical) protected void MoveTo(float inputHorizontal, float inputVertical)
{ {
var block = GetMapElement(); var block = GetMapElement();
if (block?.ElementSO.ElementType == MapElementType.Water) if (block?.ElementSO.ElementType == MapElementType.Water)
{ {