[Feat] 키보드로 대시, 어택 시 화면 터치처럼 보이는 기능

This commit is contained in:
HaeinLEE 2025-05-14 16:14:50 +09:00
parent b0ca516778
commit ffb5cec6b4
13 changed files with 82 additions and 8 deletions

View File

@ -61,6 +61,9 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
public CharacterController CharacterController => _characterController;
public bool IsBattle => _isBattle;
public Transform DashEffectAnchor => dashEffectAnchor;
[Header("대시, 어택 터치 연출용")]
[SerializeField] private DungeonPanelController dungeonPanelController;
private void Awake()
{
@ -114,6 +117,7 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
// 대시 우선 입력 처리
if (Input.GetKeyDown(KeyCode.Space))
{
dungeonPanelController.DashTouchMotion();
StartDashAction();
return;
}
@ -122,6 +126,7 @@ public class PlayerController : CharacterBase, IObserver<GameObject>
if (Input.GetKeyDown(KeyCode.X) && (_currentAction == null || !_currentAction.IsActive)
&& (CurrentState != PlayerState.Win && CurrentState != PlayerState.Dead))
{
dungeonPanelController.AttackTouchMotion();
GameManager.Instance.PlayPlayerAttackSound();
StartAttackAction();
}

View File

@ -11,6 +11,11 @@ public class DungeonPanelController : MonoBehaviour
private int _countHealth = 0;
private int visibleHeartCount = 3; // 강화 레벨로 설정됨
//PC 키보드 입력 시 버튼 색상 변경
[SerializeField] private GameObject dashPressedImage;
[SerializeField] private GameObject attackPressedImage;
private float pressedTime = .1f;
private void Start()
{
int level = UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.Heart); // 1~3
@ -50,4 +55,36 @@ public class DungeonPanelController : MonoBehaviour
{
yield return new WaitForSeconds(1.0f);
}
#region PC입력
public void DashTouchMotion()
{
StopCoroutine(DashButtonColorChange());
StartCoroutine(DashButtonColorChange());
}
public void AttackTouchMotion()
{
StopCoroutine(AttackButtonColorChange());
StartCoroutine(AttackButtonColorChange());
}
private IEnumerator DashButtonColorChange()
{
dashPressedImage.SetActive(true);
yield return new WaitForSeconds(pressedTime);
dashPressedImage.SetActive(false);
}
private IEnumerator AttackButtonColorChange()
{
attackPressedImage.SetActive(true);
yield return new WaitForSeconds(pressedTime);
attackPressedImage.SetActive(false);
}
#endregion
}

BIN
Assets/KSH/ReDungeon.unity (Stored with Git LFS)

Binary file not shown.

BIN
Assets/LIN/Prefabs/Attack Button Image.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8822dc0c2e8b5bc498036a19194f8827
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/LIN/Prefabs/Dash Button Image.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 76f779210ea250641b4559dfc6d379b5
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/LIN/ReDungeon UI Copy.unity (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ce2ba637dd19c434fa2eb509c2ad4270
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/LIN/ReHousing Loding Anim.unity (Stored with Git LFS)

Binary file not shown.

View File

@ -16,6 +16,7 @@ public class InteractionController : MonoBehaviour
private void Start()
{
PlayerStats.Instance.OnWorked -= SuddenAfterWorkEventHappen;
PlayerStats.Instance.OnWorked += SuddenAfterWorkEventHappen;
PlayerStats.Instance.SetInteractionPanelController(interactionAnimationPanelController);
}
@ -116,6 +117,7 @@ public class InteractionController : MonoBehaviour
// Interaction Controller와 같은 방식으로 작동됩니다.
private void SuddenAfterWorkEventHappen()
{
PlayerStats.Instance.OnWorked -= SuddenAfterWorkEventHappen;
AfterWorkEventType afterWorkEventType = SuddenEventCalculator();
if (afterWorkEventType == AfterWorkEventType.None) return;

BIN
Assets/Prefabs/ReDungeon/Canvas.prefab (Stored with Git LFS)

Binary file not shown.

BIN
Assets/Prefabs/ReHousing/Canvas.prefab (Stored with Git LFS)

Binary file not shown.