Added basic features

This commit is contained in:
2025-05-08 09:24:43 +09:00
parent 4acffb32e4
commit bee969f7ef
131 changed files with 69136 additions and 109 deletions

View File

@@ -0,0 +1,35 @@
using UnityEngine;
using UnityEngine.InputSystem;
namespace Assets
{
[RequireComponent(typeof(PlayerInput))]
public class PlayerInteraction : MonoBehaviour
{
[SerializeField]
private WorldSwitcher _worldSwitcher;
private PlayerInput _playerInput;
private InputAction _interactAction;
private void Awake()
{
_playerInput = GetComponent<PlayerInput>();
_interactAction = _playerInput.actions["SwitchWorld"];
}
private void OnEnable()
{
if (_interactAction != null)
{
_interactAction.Enable();
_interactAction.performed += OnInteractPerformed;
}
}
private void OnInteractPerformed(InputAction.CallbackContext context)
{
_worldSwitcher.SwitchNext();
}
}
}