using UnityEngine; using UnityEngine.InputSystem; public class SimpleThrowNiddle : MonoBehaviour { [SerializeField] private GameObject niddle; private Vector2 axis; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { } // Update is called once per frame void Update() { if (Keyboard.current.xKey.wasPressedThisFrame) { GameObject niddle_clone = Instantiate(niddle); niddle_clone.transform.position = gameObject.transform.position; SimpleNiddleMove niddlemove = niddle_clone.GetComponent(); if(axis.y == 0) { niddlemove.direction = -gameObject.transform.localScale.x; } else { niddlemove.direction = axis.x; } niddlemove.isup = axis.y; } } void OnMove(InputValue value) { axis = value.Get(); } }