Beispiel #1
0
    void Start()
    {
        // let's start by initialising the builder with the atlas scale of half
        HumanoidBuilder.Initialize(1.0f);

        // now let's generate a humanoid male
        human = new HumanoidStructure('M');

        // set the basic body slots.
        // Use color indexes from the GamePalette.cs
        HumanoidStructure.BodyAdd(human, "Human Male Eyes 01");
        HumanoidStructure.BodyAdd(human, "Human Male Head 01", 4);
        HumanoidStructure.BodyAdd(human, "Human Male HeadEars 01", 4);
        HumanoidStructure.BodyAdd(human, "Human Male HeadEyes 01", 4);
        HumanoidStructure.BodyAdd(human, "Human Male HeadMouth 01", 4);
        HumanoidStructure.BodyAdd(human, "Human Male HeadNose 01", 4);
        HumanoidStructure.BodyAdd(human, "Human Male Head InnerMouth");
        HumanoidStructure.BodyAdd(human, "Human Male Torso 01", 4);
        HumanoidStructure.BodyAdd(human, "Human Male Hands 01", 4);
        HumanoidStructure.BodyAdd(human, "Human Male Legs 01", 4);
        HumanoidStructure.BodyAdd(human, "Human Male Feet 01", 4);

        // let's add some clothing
        HumanoidStructure.WardrobeAdd(human, "Male Jeans 01", 12);
        HumanoidStructure.WardrobeAdd(human, "MaleShirt 01", 1);

        // just a test of packing a human ( just a proof it all works)
        string testpack = HumanoidStructure.Pack(human);

        Debug.Log(testpack);
        Debug.Log("Pack size " + testpack.Length);

        // now lets unpack and generate the uma (we're using the packed version just to show that packing/unpacking works)
        HumanoidStructure testhuman = HumanoidStructure.Unpack(testpack);

        myuma = HumanoidBuilder.Create(testhuman, "myumaM", animController, new Vector3(0.5f, 0, 0), 0, false, true);

        //Set up a callback thats run when UMA has finished loading
        myuma.GetComponent <UMAData>().OnCharacterCreated += UMAMaleFinished;

        // now let's generate a humanoid female
        humanf = new HumanoidStructure('F');

        // you can add tails, horns, eyelashes, etc after these basics
        // but the build order is vital to keep attachment vertex indecies
        // This time we use Color32 to set the color instead.
        HumanoidStructure.BodyAdd(humanf, "Human Female Eyes 01");
        HumanoidStructure.BodyAdd(humanf, "Human Female Head 01", new Color32(188, 188, 188, 255));
        HumanoidStructure.BodyAdd(humanf, "Human Female HeadEars 01", new Color32(188, 188, 188, 255));
        HumanoidStructure.BodyAdd(humanf, "Human Female HeadEyes 01", new Color32(188, 188, 188, 255));
        HumanoidStructure.BodyAdd(humanf, "Human Female HeadMouth 01", new Color32(188, 188, 188, 255));
        HumanoidStructure.BodyAdd(humanf, "Human Female HeadNose 01", new Color32(188, 188, 188, 255));
        HumanoidStructure.BodyAdd(humanf, "Human Female Head InnerMouth");
        HumanoidStructure.BodyAdd(humanf, "Human Female Torso 01", new Color32(188, 188, 188, 255));
        HumanoidStructure.BodyAdd(humanf, "Human Female Hands 01", new Color32(188, 188, 188, 255));
        HumanoidStructure.BodyAdd(humanf, "Human Female Legs 01", new Color32(188, 188, 188, 255));
        HumanoidStructure.BodyAdd(humanf, "Human Female Feet 01", new Color32(188, 188, 188, 255));

        // let's add some clothing
        HumanoidStructure.WardrobeAdd(humanf, "MaleShirt 01", 2);

        // just a test of packing a human ( just a proof it all works)
        string testpackf = HumanoidStructure.Pack(humanf);

        Debug.Log(testpackf);
        Debug.Log("Pack size " + testpackf.Length);

        // now lets unpack and generate the uma
        HumanoidStructure testhumanf = HumanoidStructure.Unpack(testpackf);

        myumaf = HumanoidBuilder.Create(testhumanf, "myumaF", animController, new Vector3(-0.5f, 0, 0), 0, false, true);

        //Set up a callback thats run when UMA has finished loading
        myumaf.GetComponent <UMAData>().OnCharacterCreated += UMAFemaleFinished;
    }