2026-04-03 상호작용 버그 수정
This commit is contained in:
BIN
Assets/01_Scenes/GameScene.unity
LFS
BIN
Assets/01_Scenes/GameScene.unity
LFS
Binary file not shown.
@@ -26,6 +26,8 @@ public class GameManager : MonoBehaviour
|
|||||||
public float ItemBounceFrequency = 2f; // 오르내리는 속도
|
public float ItemBounceFrequency = 2f; // 오르내리는 속도
|
||||||
|
|
||||||
[Header("Global Refer")]
|
[Header("Global Refer")]
|
||||||
|
public GameObject StaticObjectsField;
|
||||||
|
public GameObject DynamicObjectsField;
|
||||||
public HighlightProfile InteractionHighlightProfile;
|
public HighlightProfile InteractionHighlightProfile;
|
||||||
|
|
||||||
private void Awake()
|
private void Awake()
|
||||||
|
|||||||
@@ -353,6 +353,7 @@ public void SpawnItemToWorld(ItemInstance dropItem)
|
|||||||
|
|
||||||
// 빈 게임오브젝트를 생성하고 WorldItem 컴포넌트를 붙임
|
// 빈 게임오브젝트를 생성하고 WorldItem 컴포넌트를 붙임
|
||||||
GameObject dropObj = new GameObject($"{dropItem.Data.ItemName}_Dropped");
|
GameObject dropObj = new GameObject($"{dropItem.Data.ItemName}_Dropped");
|
||||||
|
dropObj.transform.SetParent(GameManager.Instance.DynamicObjectsField.transform);
|
||||||
dropObj.transform.position = dropPosition;
|
dropObj.transform.position = dropPosition;
|
||||||
|
|
||||||
WorldItem worldItem = dropObj.AddComponent<WorldItem>();
|
WorldItem worldItem = dropObj.AddComponent<WorldItem>();
|
||||||
@@ -371,4 +372,17 @@ public void DropItemFromSlot(int slotIndex)
|
|||||||
|
|
||||||
UpdateUI();
|
UpdateUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ItemUse(int slotIndex)
|
||||||
|
{
|
||||||
|
GameManager.Instance.ItemEffect.ItemUse(Items[slotIndex]);
|
||||||
|
Items[slotIndex].CurrentStack -= 1;
|
||||||
|
|
||||||
|
if (Items[slotIndex].CurrentStack <= 0)
|
||||||
|
{
|
||||||
|
Slots[slotIndex].ClearSlot();
|
||||||
|
Items[slotIndex] = null;
|
||||||
|
}
|
||||||
|
UpdateUI();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -432,9 +432,16 @@ private void JumpAction()
|
|||||||
#region 앉기
|
#region 앉기
|
||||||
public void PointSitAction(Transform trn)
|
public void PointSitAction(Transform trn)
|
||||||
{
|
{
|
||||||
_cController.enabled = false;
|
_moveInput = Vector2.zero;
|
||||||
|
_moveTargetDir = Vector3.zero;
|
||||||
|
_currentSpd = 0f;
|
||||||
|
_actionExitRequested = false;
|
||||||
|
|
||||||
_stateMachine.ChangeState(PlayerState.Action);
|
_anim.SetFloat("speedRatio", 0f);
|
||||||
|
_anim.SetFloat("DirectX", 0f);
|
||||||
|
_anim.SetFloat("DirectY", 0f);
|
||||||
|
|
||||||
|
_cController.enabled = false;
|
||||||
|
|
||||||
transform.position = trn.position;
|
transform.position = trn.position;
|
||||||
transform.rotation = trn.rotation;
|
transform.rotation = trn.rotation;
|
||||||
@@ -442,6 +449,18 @@ public void PointSitAction(Transform trn)
|
|||||||
_cController.enabled = true;
|
_cController.enabled = true;
|
||||||
|
|
||||||
_anim.SetBool("IsSit",true);
|
_anim.SetBool("IsSit",true);
|
||||||
|
|
||||||
|
RotationMode = PlayerRotationMode.CameraDecoupled;
|
||||||
|
|
||||||
|
float freezeTime = 3f;
|
||||||
|
|
||||||
|
_stateMachine.ChangeState(PlayerState.Trans);
|
||||||
|
|
||||||
|
_moveCutTimer = freezeTime;
|
||||||
|
// 앉기 진입 애니메이션 길이에 맞게 조정
|
||||||
|
_ = Util.RunDelayed(freezeTime, () => {
|
||||||
|
_stateMachine.ChangeState(PlayerState.Action);
|
||||||
|
}, default);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -451,12 +470,12 @@ public void EndAction()
|
|||||||
if (_stateMachine.CurrentState != PlayerState.Action) return;
|
if (_stateMachine.CurrentState != PlayerState.Action) return;
|
||||||
|
|
||||||
_anim.SetBool("IsSit", false);
|
_anim.SetBool("IsSit", false);
|
||||||
float FreezeTime = 2f;
|
float freezeTime = 2f;
|
||||||
|
|
||||||
_stateMachine.ChangeState(PlayerState.Trans);
|
_stateMachine.ChangeState(PlayerState.Trans);
|
||||||
|
|
||||||
_moveCutTimer = FreezeTime;
|
_moveCutTimer = freezeTime;
|
||||||
_ = Util.RunDelayed(FreezeTime, () => {
|
_ = Util.RunDelayed(freezeTime, () => {
|
||||||
_stateMachine.ChangeState(PlayerState.Idle);
|
_stateMachine.ChangeState(PlayerState.Idle);
|
||||||
RotationMode = PlayerRotationMode.CameraCoupled;
|
RotationMode = PlayerRotationMode.CameraCoupled;
|
||||||
InteractionOnTarget.InteractEnd(this);
|
InteractionOnTarget.InteractEnd(this);
|
||||||
@@ -590,12 +609,11 @@ public void AimToggleInput(InputState inputState)
|
|||||||
public void InteractInput()
|
public void InteractInput()
|
||||||
{
|
{
|
||||||
if (ActionExitCheck()) return;
|
if (ActionExitCheck()) return;
|
||||||
|
if (_stateMachine.CurrentState == PlayerState.Trans) return;
|
||||||
|
|
||||||
if (InteractionTargets.Count > 0)
|
if (InteractionTargets.Count > 0)
|
||||||
{
|
{
|
||||||
InteractionOnTarget.InteractExec(this); // 실제 상호작용 실행
|
InteractionOnTarget.InteractExec(this); // 실제 상호작용 실행
|
||||||
|
|
||||||
RotationMode = PlayerRotationMode.CameraDecoupled;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -188,14 +188,10 @@ public void OnPointerClick(PointerEventData eventData)
|
|||||||
// 우클릭
|
// 우클릭
|
||||||
if (eventData.button == PointerEventData.InputButton.Right)
|
if (eventData.button == PointerEventData.InputButton.Right)
|
||||||
{
|
{
|
||||||
ItemUse();
|
if(currentItem != null) //아이템이 존재할시에만 사용
|
||||||
|
{
|
||||||
|
GameManager.Instance.Inventory.ItemUse(SlotIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ItemUse()
|
|
||||||
{
|
|
||||||
GameManager.Instance.ItemEffect.ItemUse(currentItem);
|
|
||||||
currentItem.CurrentStack -= 1;
|
|
||||||
UpdateSlotUI();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user