7579175d24
- 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.
57 lines
1.7 KiB
C#
57 lines
1.7 KiB
C#
using UnityEngine;
|
|
|
|
public class EnemyAI : Character
|
|
{
|
|
protected override void SetClimbingAnimation(bool isClimbing)
|
|
{
|
|
}
|
|
|
|
protected override void SetWalkingAnimation(bool isWalking)
|
|
{
|
|
_animator.SetBool("Walk",isWalking);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
// float horizontal = 0;
|
|
// float vertical = 0;
|
|
|
|
// Vector2 directionToPlayer = Player.Instance.transform.position - transform.position;
|
|
// directionToPlayer.Normalize();
|
|
|
|
// float verticalDistance = Player.Instance.transform.position.y - transform.position.y;
|
|
|
|
// if (Mathf.Abs(verticalDistance) > 0.1f && (isCanClimbUp || isCanGoDown))
|
|
// {
|
|
// vertical = Mathf.Sign(verticalDistance);
|
|
// }
|
|
// else
|
|
// {
|
|
// if (Mathf.Abs(Player.Instance.transform.position.x - transform.position.x) < 0.1f)
|
|
// {
|
|
// horizontal = 0;
|
|
// }
|
|
// else if (directionToPlayer.x < 0)
|
|
// { horizontal = -1; }
|
|
// else if (directionToPlayer.x > 0)
|
|
// { horizontal = 1; }
|
|
// }
|
|
|
|
// if (Input.GetKey(KeyCode.T))
|
|
// { vertical = 1; }
|
|
// if (Input.GetKey(KeyCode.G))
|
|
// { vertical = -1; }
|
|
|
|
// Debug.Log($"Enemy Position: {transform.position}, Player Position: {Player.Instance.transform.position}");
|
|
// Debug.Log($"Vertical Distance: {verticalDistance}, Vertical Movement: {vertical}");
|
|
|
|
// base.MoveTo(horizontal, vertical);
|
|
}
|
|
|
|
private float VerticalMove(float verticalDistance)
|
|
{
|
|
float verticalDirection = Mathf.Sign(verticalDistance);
|
|
return verticalDirection;
|
|
}
|
|
}
|