コード例 #1
0
    public void SpawnChars()
    {
        int        i = 0;
        GameObject npc;

        foreach (GameObject point in points)
        {
            // If Male
            if (PlayerSheet.GetSex(i) == 1)
            {
                npc = Prefabs[(int)point.GetComponent <Spawner>().thisOrientation];
            }

            // If Female
            else
            {
                npc = Prefabs[(int)point.GetComponent <Spawner>().thisOrientation + 4];
            }

            GameObject clone = Instantiate(npc, point.transform.position, Quaternion.identity, NPCHolder.transform);
            NPCs[i] = clone;

            clone.GetComponentInChildren <TextMesh>().text = PlayerSheet.GetName(i).ToUpper();
            clone.GetComponentInChildren <MeshRenderer>().sortingLayerName = "Overlay";
            clone.GetComponentInChildren <MeshRenderer>().sortingOrder     = 1;

            clone.GetComponent <NPC>().top.color    = cliqueColors[PlayerSheet.GetTypeOne(i) - 1];
            clone.GetComponent <NPC>().bottom.color = cliqueColors[(PlayerSheet.GetTypeTwo(i) - 1)];
            clone.GetComponent <NPC>().skin.color   = skinTones[PlayerSheet.GetIndex(i) % 5];
            clone.GetComponent <NPC>().SetID(i);

            if (PlayerSheet.GetIndex(i) >= 64 && PlayerSheet.GetParameter(i, (int)ParameterType.Exposed))
            {
                clone.GetComponentInChildren <TextMesh>().color = infectedFriend;
            }
            else if (PlayerSheet.GetIndex(i) >= 64)
            {
                clone.GetComponentInChildren <TextMesh>().color = friendColor;
            }
            else if (PlayerSheet.GetParameter(i, (int)ParameterType.Exposed))
            {
                clone.GetComponentInChildren <TextMesh>().color = infectedColor;
            }
            else
            {
                clone.GetComponentInChildren <TextMesh>().color = Color.white;
            }
            i++;
        }
    }