Add player controller, state management, and input handling

- Implemented PlayerController.cs to manage player movement and actions.
- Created PlayerState.cs to track player lives, coins, and key status.
- Added CameraFollow.cs for smooth camera movement following the player.
- Developed Character.cs as an abstract class for character behavior.
- Introduced Enums.cs for defining TreasureType and MapElementType.
- Added IDoor interface for door interactions.
- Created InputActions.cs for handling player input actions.
- Implemented MainMenu.cs for basic menu functionality including play and exit options.
This commit is contained in:
2026-06-17 22:43:59 +03:00
parent dabd056e8b
commit 39e4e51866
70 changed files with 1807 additions and 99 deletions
@@ -2,6 +2,9 @@
public class BreakableWall : MapElement
{
[SerializeField] private float _noiseRadius = 10f;
[SerializeField] private bool _emitNoiseOnBreak = true;
private float _respawnElementTimer;
private int _respawnTimeout = 4;
private bool _needRespawn = false;
@@ -16,18 +19,24 @@ public class BreakableWall : MapElement
private void Start()
{
_respawnElementTimer = _respawnTimeout;
_boxCollider =GetComponent<BoxCollider2D>();
_spriteRenderer= GetComponentInChildren<SpriteRenderer>();
_boxCollider = GetComponent<BoxCollider2D>();
_spriteRenderer = GetComponentInChildren<SpriteRenderer>();
}
public override void Hit()
{
IsEnabled = false;
_boxCollider.isTrigger=true;
_boxCollider.isTrigger = true;
_spriteRenderer.enabled = IsEnabled;
Instantiate(_hitParticles, transform.position, Quaternion.identity);
// Emit noise when wall breaks
if (_emitNoiseOnBreak && NoiseSystem.Instance != null)
{
NoiseSystem.Instance.Emit(transform.position, _noiseRadius);
}
_respawnElementTimer = _respawnTimeout;
_needRespawn = true;
}
@@ -41,7 +50,7 @@ public class BreakableWall : MapElement
{
_respawnElementTimer = _respawnTimeout;
if(_characterInRange)
if (_characterInRange)
{
print("Character is dead");
}
@@ -70,6 +79,4 @@ public class BreakableWall : MapElement
_characterInRange = false;
}
}
}
}