예제 #1
0
    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>();
    }
예제 #2
0
  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>();
  }