21 lines
516 B
C#
Raw Normal View History

2020-03-11 21:11:27 +01:00
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);
}
}