스페이스바 누름 구현
This commit is contained in:
32
Assets/Scripts/Gazuaa.cs
Normal file
32
Assets/Scripts/Gazuaa.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
public class Gazuaa : MonoBehaviour
|
||||
{
|
||||
private GazuaInput _gazuaInput;
|
||||
|
||||
public GameObject map;
|
||||
public GameObject avatarPrefab;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_gazuaInput = new GazuaInput();
|
||||
_gazuaInput.Enable();
|
||||
|
||||
_gazuaInput.Player.Gacha.performed += Gacha;
|
||||
}
|
||||
|
||||
private void Gacha(InputAction.CallbackContext obj)
|
||||
{
|
||||
var result = Randomizer.GetResult();
|
||||
for(var i = 0; i < result; i++) Instantiate(avatarPrefab, map.transform);
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
_gazuaInput.Disable();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user