Exemplo n.º 1
0
    public Face GenerateNewFace(GrandData targ)
    {
        GameObject _base = (GameObject)Instantiate(Base.GetObject(targ.Info.Gender, targ.Info.Base.Index));

        Face final = _base.GetComponent <Face>();

        final.FaceChildren.Left_Eye   = Instantiate(Eye.GetObject(targ.Info.Gender, targ.Info.Eye.Index)).GetComponent <Face_Obj>();
        final.FaceChildren.Right_Eye  = Instantiate(Eye.GetObject(targ.Info.Gender, targ.Info.Eye.Index)).GetComponent <Face_Obj>();
        final.FaceChildren.Left_Ear   = Instantiate(Ear.GetObject(targ.Info.Gender, targ.Info.Ear.Index)).GetComponent <Face_Obj>();
        final.FaceChildren.Right_Ear  = Instantiate(Ear.GetObject(targ.Info.Gender, targ.Info.Ear.Index)).GetComponent <Face_Obj>();
        final.FaceChildren.Left_Brow  = Instantiate(Brow.GetObject(targ.Info.Gender, targ.Info.Brow.Index)).GetComponent <Face_Obj>();
        final.FaceChildren.Right_Brow = Instantiate(Brow.GetObject(targ.Info.Gender, targ.Info.Brow.Index)).GetComponent <Face_Obj>();

        final.FaceChildren.Hair = Instantiate(Hair.GetObject(targ.Info.Gender, targ.Info.Hair.Index)).GetComponent <Face_Obj>();
        final.FaceChildren.Nose = Instantiate(Nose.GetObject(targ.Info.Gender, targ.Info.Nose.Index)).GetComponent <Face_Obj>();
        final.FaceChildren.Jaw  = Instantiate(Jaw.GetObject(targ.Info.Gender, targ.Info.Jaw.Index)).GetComponent <Face_Obj>();

        if (targ.Info.Glasses != null)
        {
            final.Glasses_Left  = Instantiate(Glasses.GetObject(true, targ.Info.Glasses.Index)).GetComponent <Face_Obj>();
            final.Glasses_Right = Instantiate(Glasses.GetObject(true, targ.Info.Glasses.Index)).GetComponent <Face_Obj>();
        }

        final.Create(targ.Info);

        _base.transform.SetParent(GameManager.GetWorldObjects().transform);
        _base.transform.localPosition = Vector3.zero;

        _base.name = targ.Info.Name;
        targ.Faces.Add(final);
        return(final);
    }