Пример #1
0
    void Update()
    {
        WanderingAI behavior = GetComponent <WanderingAI> ();

        if (Vector3.Distance(transform.position, _player.transform.position) < seeDistance)
        {
            _target = _player;
            behavior.Shoot(true);
        }
        else
        {
            _target = null;
            behavior.Shoot(false);
        }

        if (_target)
        {
            navigate.SetDestination(_target.transform.position);
        }
    }