Skip to content

Commit

Permalink
Feat: Enter Store
Browse files Browse the repository at this point in the history
  • Loading branch information
NearthYou committed Dec 2, 2024
1 parent 1e24abf commit 5d07403
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 8 deletions.
25 changes: 25 additions & 0 deletions Assets/Scripts/Runtime/CH2/SuperArio/ArioStore.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Runtime.CH2.SuperArio;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ArioStore : MonoBehaviour
{
[SerializeField] private GameObject _ario;

private void Start()
{
ArioManager.instance.OnEnterStore += EnterStore;
}

private void OnDestroy()
{
ArioManager.instance.OnEnterStore -= EnterStore;
}

public void EnterStore(bool isTrue)
{
_ario.SetActive(true);
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/Runtime/CH2/SuperArio/ArioStore.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 11 additions & 6 deletions Assets/Scripts/Runtime/CH2/SuperArio/Mario.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@ private void Start()
_spr = GetComponent<SpriteRenderer>();
initSprite = _spr.sprite;
_startPos = transform.position;
ArioManager.instance.onPlay += InitData;
ArioManager.instance.OnPlay += InitData;
}

private void OnDestroy()
{
ArioManager.instance.OnPlay -= InitData;
}

private void Update()
Expand Down Expand Up @@ -67,18 +72,18 @@ private IEnumerator Sit()

private void InitData(bool isPlay)
{
transform.position = _startPos;
_spr.sprite = initSprite;
_isJump = false;
_isTop = false;

if (isPlay)
{
transform.position = _startPos;
_isJump = false;
_isTop = false;
_ani.enabled = true;
_spr.sprite = initSprite;
}
else
{
_ani.enabled = false;
_isJump = false;
StopAllCoroutines();
}
}
Expand Down
21 changes: 20 additions & 1 deletion Assets/Scripts/Runtime/CH2/SuperArio/SAKeyBinder.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Runtime.Common.View;
using UnityEngine;
using UnityEngine.InputSystem;

namespace Runtime.CH2.SuperArio
{
Expand All @@ -22,7 +23,7 @@ private void InitKeyBinding()

public void PauseKeyInput()
{
Ario.PauseKeyInput();
ArioManager.instance.isPause = !ArioManager.instance.isPause;
}

public void ItemKeyInput()
Expand All @@ -34,5 +35,23 @@ public void RestartSuperArio()
{
ArioManager.instance.RestartSuperArio();
}

public void EnterStoreKeyInput(InputAction.CallbackContext context)
{
// 아래 방향키
if (ArioManager.instance.isPlay || ArioManager.instance.isPause)
return;

Vector2 moveInput = context.ReadValue<Vector2>();

if (context.performed)
{
if (moveInput.y < 0) // 아래쪽
{
//EnterStore
ArioManager.instance.EnterStore();
}
}
}
}
}
2 changes: 1 addition & 1 deletion Assets/Scripts/Runtime/Input/InGameKeyBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ public void SAKeyBinding(SAKeyBinder keyBinder, SettingsUIView settingsUIView)

_gameOverControls.Player.Enable();
_gameOverControls.Player.Move.performed += keyBinder.Ario.OnMove;
_gameOverControls.Player.Move.performed += keyBinder.EnterStoreKeyInput;
_gameOverControls.Player.Move.started += keyBinder.Ario.OnMove;
_gameOverControls.Player.Move.canceled += keyBinder.Ario.OnMove;
_gameOverControls.Player.Interaction.performed += _ => keyBinder.ItemKeyInput();

}

// CH1
Expand Down

0 comments on commit 5d07403

Please sign in to comment.