public void Initialize(Transform[] spots) { _action = new Dictionary <EnemyState, Action>(); _action.Add(EnemyState.Move, Move); _action.Add(EnemyState.Alert, Alert); _action.Add(EnemyState.Chase, Chase); _spot = new List <Transform>(); foreach (var spot in spots) { _spot.Add(spot); } _agent = GetComponent <NavMeshAgent>(); _agent.SetDestination(_spot[_spotID].position); _originSpeed = _agent.speed; _detect = GetComponent <EnemyDetectArea>(); }
public void Initialize(Transform[] spots) { _action = new Dictionary<EnemyState, Action>(); _action.Add(EnemyState.Move, Move); _action.Add(EnemyState.Alert, Alert); _action.Add(EnemyState.Chase, Chase); _spot = new List<Transform>(); foreach (var spot in spots) { _spot.Add(spot); } _agent = GetComponent<NavMeshAgent>(); _agent.SetDestination(_spot[_spotID].position); _originSpeed = _agent.speed; _detect = GetComponent<EnemyDetectArea>(); }