Пример #1
0
        public void CreateAvatars()
        {
            //clone the default male and female bodies
            //make sure the character bodies parent doesn't get changed by tab visibility
            CharacterBodiesParent.tag = Globals.TagIgnoreTab;
            CharacterBody body = null;

            if (Characters.Get.GetBody(true, Globals.DefaultFemalePlayerBody, out body))
            {
                GameObject newBody = GameObject.Instantiate(body.gameObject) as GameObject;
                newBody.transform.parent        = CharacterBodiesParent;
                newBody.transform.localScale    = Vector3.one;
                newBody.transform.localPosition = Vector3.zero;
                newBody.transform.localRotation = Quaternion.identity;
                FemaleBody = newBody.GetComponent <CharacterBody>();
            }
            else
            {
                Debug.LogError("Couldn't get female body in character creator");
            }

            if (Characters.Get.GetBody(true, Globals.DefaultMalePlayerBody, out body))
            {
                GameObject newBody = GameObject.Instantiate(body.gameObject) as GameObject;
                newBody.transform.parent        = CharacterBodiesParent;
                newBody.transform.localScale    = Vector3.one;
                newBody.transform.localPosition = Vector3.zero;
                newBody.transform.localRotation = Quaternion.identity;
                MaleBody = newBody.GetComponent <CharacterBody>();
            }
            else
            {
                Debug.LogError("Couldn't get female body in character creator");
            }
            MaleBody.Initialize(null);
            FemaleBody.Initialize(null);
            MaleBody.SetVisible(true);
            FemaleBody.SetVisible(true);
            MaleBody.gameObject.SetLayerRecursively(Globals.LayerNumHidden);
            FemaleBody.gameObject.SetLayerRecursively(Globals.LayerNumHidden);
        }