Exemple #1
0
    public void SpawnFollowers(Leader l)
    {
        for (int i = 0; i < _settings.followersForCapturing; i++)
        {
            while (true)
            {
                Vector3 temp = l.transform.position + Random.insideUnitSphere * Random.Range(3, 10);

                if (NavMesh.SamplePosition(temp, out NavMeshHit hit, 50, NavMesh.AllAreas))
                {
                    Vector3 pos = hit.position;
                    Npc     go  = Instantiate(_settings.npcPrefab, pos, Quaternion.identity, transform).GetComponent <Npc>();
                    l.AddFollower(go);

                    break;
                }
            }
        }
    }