17 lines
368 B
C#
17 lines
368 B
C#
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
|
|
public class PlayerBergerak : MonoBehaviour
|
|
{
|
|
public float speed = 1.5f;
|
|
|
|
void Update()
|
|
{
|
|
if (Keyboard.current.spaceKey.wasPressedThisFrame || Gamepad.current?.buttonSouth.isPressed == true)
|
|
{
|
|
transform.Translate(transform.forward * speed * Time.deltaTime);
|
|
}
|
|
}
|
|
}
|
|
|