Example #1
0
    private void RandomNonPlayerCharacterMake()
    {
        int                randomNpcValue      = Random.Range(0, nonPlayerCharacter.Length);
        int                randomPositionValue = Random.Range(0, npcCreatePosition.transform.childCount);
        GameObject         npcCreatePoint      = npcCreatePosition.transform.GetChild(randomPositionValue).gameObject;
        GameObject         tmpCivil            = Instantiate(nonPlayerCharacter[randomNpcValue], npcCreatePoint.transform.GetChild(0).position, npcCreatePoint.transform.GetChild(0).rotation);
        NonPlayerCharacter npc = tmpCivil.GetComponent <NonPlayerCharacter>();

        if (gameObject.activeInHierarchy)
        {
            StartCoroutine(npc.FollowPoint(npcCreatePoint));
        }
    }