add unity project

add example for FSM
This commit is contained in:
2025-04-08 13:03:11 +02:00
parent 7e484e4831
commit 19a08085fe
81 changed files with 7741 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
using System;
using UnityEngine;
using UnityEngine.InputSystem;
namespace DefaultNamespace
{
public class FireButton : MonoBehaviour
{
[SerializeField] private InputAction _fireAction;
private bool _isFired = false;
private void Awake()
{
_fireAction.performed += OnFired;
}
private void Update()
{
_isFired = _isFired || _fireAction.triggered;
}
private void FixedUpdate()
{
// movement
// rotation
// fire
if (_isFired)
{
_isFired = false;
// spawn bullet
}
}
private void OnFired(InputAction.CallbackContext ctx)
{
}
private void OnEnable()
{
_fireAction.Enable();
}
private void OnDisable()
{
_fireAction.Disable();
}
}
}