mirror of
https://github.com/unity-atoms/unity-atoms.git
synced 2025-01-25 17:38:24 -05:00
21 lines
516 B
C#
21 lines
516 B
C#
|
using UnityAtoms.BaseAtoms;
|
|||
|
using UnityAtoms.FSM;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
public class EnemyShooting : MonoBehaviour
|
|||
|
{
|
|||
|
[SerializeField]
|
|||
|
private FiniteStateMachineReference _enemyState;
|
|||
|
[SerializeField]
|
|||
|
private GameObject _projectile;
|
|||
|
|
|||
|
void Awake()
|
|||
|
{
|
|||
|
_enemyState.Machine.OnStateCooldown("ATTACKING", (value) =>
|
|||
|
{
|
|||
|
var spawnPos = transform.position + transform.right;
|
|||
|
Instantiate(_projectile, spawnPos, transform.rotation);
|
|||
|
}, gameObject);
|
|||
|
}
|
|||
|
}
|