Пример #1
0
    private void EnoughStoneForSuperVillager()
    {
        if (GetStoneCount() % 2 == 0 && !spawnedSuperVillager)
        {
            AddNewsUpdate("Super Villager was born!");
            WanderingAI wanderingAi = superVillager.GetComponent <WanderingAI>();
            wanderingAi.SetCamp(this);

            spawner.SpawnPrefab(superVillager);
            spawnedSuperVillager = true;
        }
    }
Пример #2
0
    void Start()
    {
        for (int i = 0; i < numberOfObjects; i++)
        {
            float      angle        = i * Mathf.PI * 2 / numberOfObjects;
            float      x            = Mathf.Cos(angle) * radius;
            float      z            = Mathf.Sin(angle) * radius;
            Vector3    pos          = transform.position + new Vector3(x, 0, z);
            float      angleDegrees = -angle * Mathf.Rad2Deg;
            Quaternion rot          = Quaternion.Euler(0, angleDegrees, 0);

            // Set the AI home
            WanderingAI  wanderingAi  = prefab.GetComponent <WanderingAI>();
            VillagerCamp villagerCamp = GetComponent <VillagerCamp>();
            if (wanderingAi)
            {
                wanderingAi.SetCamp(villagerCamp);
            }

            spawns.Add(Instantiate(prefab, pos, rot));
        }
    }