인게임 ui에 상호작용 텍스트 출력
인벤토리(손에 든 아이템)에 변동이 있을 때마다 적용
엑셀파일 ItemTable의 ActionText 사용
InGameUI.cs
private void SetInteractKey(IInteractable interact) { if(interact == null) { interactKeyText.text = ""; } else { interactKeyText.text = "[Shift + right-click]\n: " + interact.ActionText; } }Init()에 함수 연결
EntityManager.Instance.Player.PlayerInventory.OnHandItemChanged += SetInteractKey;PlayerInventory.cs
- 각 상태에 따라 적용public void SetHand() -> OnHandItemChanged?.Invoke(item); private void DropItem() -> OnHandItemChanged?.Invoke(groundItemStack.TryPeek(out InHandItem nextItem) ? nextItem : null);
실행 결과
if (isFallen) return; rb.isKinematic = false; rb.constraints = RigidbodyConstraints.None; Vector3 forceDirection = forcePosition.right; rb.AddForceAtPosition(forceDirection * forceAmount, forcePosition.position, ForceMode.Impulse); isFallen = true; rb.isKinematic = true;
public void PlayHitSound() { if (!isPlaying) { isPlaying = true; Managers.Sound.SFX3DPlay(hitSound, this.transform); } } public void PlayWalkSound() { curTime += Time.deltaTime; if (curTime > maxWalkingTime) { Managers.Sound.SFX3DPlay(walkSound, this.transform); curTime = 0f; } } public void OnResetState() { isPlaying = false; curTime = 0f; }
+ MonsterFleeing 상태, Stun 상태 -> MonsterFleeing 상태로 통합