Refactor and reorganize scripts for improved structure and functionality
- Removed obsolete scripts: Chest, BreakableWall, Door, DoorInteract, and UiManager. - Moved Chest and BreakableWall scripts to EnvironmentObjects folder. - Introduced HammerThrower class to manage hammer throwing mechanics. - Updated PlayerController to utilize new InputManager and HammerThrower. - Refactored PlayerState to manage player state and item collection. - Enhanced UI management in UiManager to reflect player item collection. - Updated EnemyAI to remove unused movement logic. - Adjusted KeyChest to interact with PlayerState instead of Player. - Cleaned up code and improved event handling for item collection.
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
using System.Security;
|
||||
using UnityEngine;
|
||||
|
||||
public class KeyChest : MonoBehaviour
|
||||
{
|
||||
private void OnTriggerEnter2D(Collider2D collider)
|
||||
{
|
||||
var player = collider.GetComponent<Player>();
|
||||
if (player != null)
|
||||
var playerState = collider.GetComponent<PlayerState>();
|
||||
if (playerState != null)
|
||||
{
|
||||
player.SetKey();
|
||||
playerState.SetKey();
|
||||
Destroy(gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user