예제 #1
0
파일: Building.cs 프로젝트: GUIOCK/Pandor
    void SetupNPCs()
    {
        int nbPeople;

        if (preInfected != 0)
        {
            nbPeople = Random.Range(preInfected, preInfected + 4);
        }
        else
        {
            nbPeople = Random.Range(1, 4);
        }

        for (int i = 0; i < nbPeople; i++)
        {
            GameObject npc          = Instantiate(this.npc, transform.position, transform.rotation);
            People     npcComponent = npc.GetComponent <People>();
            npcComponent.home            = this.gameObject;
            npcComponent.calculInfection = GetComponentInParent <CalculInfection>();
            int nbFriends = Random.Range(1, 5);
            for (int j = 0; j < nbFriends; j++)
            {
                npcComponent.AddFriend(homeBuildings[Random.Range(0, homeBuildings.Count)]);
            }
            npcComponent.AddCenter(centerBuildings[Random.Range(0, centerBuildings.Count)]);
            if (preInfected != 0)
            {
                Debug.Log("Le isInfected dans la création : ");
                Debug.Log(npcComponent.isInfected);
                npcComponent.isInfected = true;
                Debug.Log(npcComponent.isInfected);
            }
        }
    }