Exemplo n.º 1
0
    void SpawnNpcAtPosition(NpcSpawnData.spawnPoint spawnPoint)
    {
        NonPlayerCharacter npc;

        npc = PhotonNetwork.Instantiate(npcPrefab.name, spawnPoint.coordinates, Quaternion.identity)
              .GetComponentInChildren <NonPlayerCharacter>();
        if (spawnPoint.isStationary)
        {
            npc.SetInputSource(new StationaryNpcInput());
        }
        else
        {
            npc.SetInputSource(new DefaultNpcInput());
        }
        if (spawnPoint.isInfected)
        {
            npc.Infect();
            // Instantiate new dummy CharacterSpawner so that the npc can spawn a parasite when it
            //	gets fried
            npc.CharacterSpawner = new CharacterSpawner(TutorialManager.OnParasiteKilled);
        }
        // Hide default "[Player Name]" nametag text
        npc.SetName(null);
        NpcList.Add(npc);
    }
Exemplo n.º 2
0
    void SpawnNpcGroup(NpcSpawnData.spawnPoint spawnCenter)
    {
        // This should only ever run on the Master Client
        int     npcCount = SelectNpcGroupSize();
        Vector2 spawnPosition;

        for (int i = 0; i < npcCount; i++)
        {
            spawnPosition = SelectSpawnPosition(spawnCenter.coordinates);
            SpawnNpcAtPosition(spawnPosition);
        }
    }