Exemplo n.º 1
0
    public FlatBodyObject(CharacterTextureBehaviour aChar, int aDepth = -1)
    {
        create_body(aChar);
        PrimaryGameObject = new GameObject("genBodyParent");
        mParts[ZgJointId.Waist].transform.parent = PrimaryGameObject.transform;
        mParts[ZgJointId.Torso].transform.parent = PrimaryGameObject.transform;
        SoftColor         = new Color(0.5f, 0.5f, 0.5f, 0.5f);
        SoftInterpolation = 0.08f;

        UseDepth = (aDepth != -1);
        if (UseDepth)
        {
            Depth = aDepth;
        }
    }
Exemplo n.º 2
0
    public ChoiceObjectPair(Texture2D aLeftTex, CharacterTextureBehaviour aChar, Pose aPose, int aDepth)
    {
        mSquare = new FlatElementImage(aLeftTex, aDepth);
        //NOTE these assets were removed since this class is no longer being used.
        //mDifficultyStars = new DifficultyObject(ManagerManager.Manager.mNewRef.uiPerfectStar, aDepth);
        //mDifficultyBalls = new DifficultyObject(ManagerManager.Manager.mNewRef.uiPerfectStar, aDepth);


        mElements.Add(new FlatElementMultiBase.ElementOffset(mSquare, new Vector3(mSide, 0, 0)));
        mElements.Add(new FlatElementMultiBase.ElementOffset(mDifficultyStars, new Vector3(-mSide, mRightBot, 0)));
        mElements.Add(new FlatElementMultiBase.ElementOffset(mDifficultyBalls, new Vector3(-mSide, mRightBot, 0)));

        mMeter            = new MeterImageObject(aLeftTex, null, MeterImageObject.FillStyle.DU, aDepth + 1);
        mMeter.Percentage = 0.0f;
        mBody             = new FlatBodyObject(aChar, aDepth + 2);
        mBody.set_target_pose(aPose);
        mElements.Add(new FlatElementMultiBase.ElementOffset(mMeter, new Vector3(mSide, 0, 0)));
        mElements.Add(new FlatElementMultiBase.ElementOffset(mBody, new Vector3(mSide + 24, -7, 0)));

        PrimaryGameObject = create_primary_from_elements();
    }
Exemplo n.º 3
0
    //useful
    //NOTE this does not support extremeties
    void create_body(CharacterTextureBehaviour aChar)
    {
        GameObject torso         = create_object(ZgJointId.Torso, aChar.torso, aChar.atTorso);
        GameObject waist         = create_object(ZgJointId.Waist, aChar.waist, aChar.atWaist);
        GameObject head          = create_object(ZgJointId.Neck, aChar.head, aChar.atHead);
        GameObject leftUpperArm  = create_object(ZgJointId.LeftShoulder, aChar.leftUpperArm, aChar.atLeftUpperArm);
        GameObject rightUpperArm = create_object(ZgJointId.RightShoulder, aChar.rightUpperArm, aChar.atRightUpperArm);
        GameObject leftLowerArm  = create_object(ZgJointId.LeftElbow, aChar.leftLowerArm, aChar.atLeftLowerArm);
        GameObject rightLowerArm = create_object(ZgJointId.RightElbow, aChar.rightLowerArm, aChar.atRightLowerArm);
        GameObject leftUpperLeg  = create_object(ZgJointId.LeftHip, aChar.leftUpperLeg, aChar.atLeftUpperLeg);
        GameObject rightUpperLeg = create_object(ZgJointId.RightHip, aChar.rightUpperLeg, aChar.atRightUpperLeg);
        GameObject leftLowerLeg  = create_object(ZgJointId.LeftKnee, aChar.leftLowerLeg, aChar.atLeftLowerLeg);
        GameObject rightLowerLeg = create_object(ZgJointId.RightKnee, aChar.rightLowerLeg, aChar.atRightLowerLeg);

        //order things
        Dictionary <ZgJointId, GameObject> jointObject  = new Dictionary <ZgJointId, GameObject>();
        Dictionary <ZgJointId, Texture2D>  jointTexture = new Dictionary <ZgJointId, Texture2D>();

        jointObject[ZgJointId.Torso]         = torso;
        jointObject[ZgJointId.Waist]         = waist;
        jointObject[ZgJointId.Neck]          = head;
        jointObject[ZgJointId.LeftShoulder]  = leftUpperArm;
        jointObject[ZgJointId.RightShoulder] = rightUpperArm;
        jointObject[ZgJointId.LeftElbow]     = leftLowerArm;
        jointObject[ZgJointId.RightElbow]    = rightLowerArm;
        jointObject[ZgJointId.LeftHip]       = leftUpperLeg;
        jointObject[ZgJointId.RightHip]      = rightUpperLeg;
        jointObject[ZgJointId.LeftKnee]      = leftLowerLeg;
        jointObject[ZgJointId.RightKnee]     = rightLowerLeg;


        jointTexture[ZgJointId.Torso]         = aChar.atTorso;
        jointTexture[ZgJointId.Waist]         = aChar.atWaist;
        jointTexture[ZgJointId.Neck]          = aChar.atHead;
        jointTexture[ZgJointId.LeftShoulder]  = aChar.atLeftUpperArm;
        jointTexture[ZgJointId.RightShoulder] = aChar.atRightUpperArm;
        jointTexture[ZgJointId.LeftElbow]     = aChar.atLeftLowerArm;
        jointTexture[ZgJointId.RightElbow]    = aChar.atRightLowerArm;
        jointTexture[ZgJointId.LeftHip]       = aChar.atLeftUpperLeg;
        jointTexture[ZgJointId.RightHip]      = aChar.atRightUpperLeg;
        jointTexture[ZgJointId.LeftKnee]      = aChar.atLeftLowerLeg;
        jointTexture[ZgJointId.RightKnee]     = aChar.atRightLowerLeg;


        //these two are special
        torso.transform.position  = waist.transform.position;
        torso.transform.position += get_Z_offset(ZgJointId.Torso);
        waist.transform.position += get_Z_offset(ZgJointId.Waist);

        List <KeyValuePair <ZgJointId, ZgJointId> > relations = new List <KeyValuePair <ZgJointId, ZgJointId> >();

        relations.Add(new KeyValuePair <ZgJointId, ZgJointId>(ZgJointId.LeftShoulder, ZgJointId.Torso));
        relations.Add(new KeyValuePair <ZgJointId, ZgJointId>(ZgJointId.RightShoulder, ZgJointId.Torso));
        relations.Add(new KeyValuePair <ZgJointId, ZgJointId>(ZgJointId.LeftElbow, ZgJointId.LeftShoulder));
        relations.Add(new KeyValuePair <ZgJointId, ZgJointId>(ZgJointId.RightElbow, ZgJointId.RightShoulder));
        relations.Add(new KeyValuePair <ZgJointId, ZgJointId>(ZgJointId.LeftHip, ZgJointId.Waist));
        relations.Add(new KeyValuePair <ZgJointId, ZgJointId>(ZgJointId.RightHip, ZgJointId.Waist));
        relations.Add(new KeyValuePair <ZgJointId, ZgJointId>(ZgJointId.LeftKnee, ZgJointId.LeftHip));
        relations.Add(new KeyValuePair <ZgJointId, ZgJointId>(ZgJointId.RightKnee, ZgJointId.RightHip));
        relations.Add(new KeyValuePair <ZgJointId, ZgJointId>(ZgJointId.Neck, ZgJointId.Torso));


        foreach (KeyValuePair <ZgJointId, ZgJointId> e in relations)
        {
            jointObject[e.Key].transform.parent   = jointObject[e.Value].transform;
            jointObject[e.Key].transform.position =
                jointObject[e.Value].transform.position
                + get_offset_of_plane(jointObject[e.Value].transform)
                + get_connection_point_image(e.Key, e.Value, jointTexture[e.Value])
                + get_Z_offset(e.Key)
                - get_Z_offset(e.Value);
        }

        List <KeyValuePair <GameObject, float> > rotateMe = new List <KeyValuePair <GameObject, float> >();

        rotateMe.Add(new KeyValuePair <GameObject, float>(leftUpperArm, -90));
        rotateMe.Add(new KeyValuePair <GameObject, float>(rightUpperArm, -90));

        rotateMe.Add(new KeyValuePair <GameObject, float>(leftUpperLeg, -90));
        rotateMe.Add(new KeyValuePair <GameObject, float>(rightUpperLeg, -90));
        rotateMe.Add(new KeyValuePair <GameObject, float>(torso, 90));
        rotateMe.Add(new KeyValuePair <GameObject, float>(waist, -90));
        rotateMe.Add(new KeyValuePair <GameObject, float>(head, 90));

        rotateMe.Add(new KeyValuePair <GameObject, float>(leftLowerLeg, -90));
        rotateMe.Add(new KeyValuePair <GameObject, float>(rightLowerLeg, -90));
        rotateMe.Add(new KeyValuePair <GameObject, float>(leftLowerArm, -90));
        rotateMe.Add(new KeyValuePair <GameObject, float>(rightLowerArm, -90));

        foreach (KeyValuePair <GameObject, float> e in rotateMe)
        {
            GameObject tempParent = new GameObject("genTempParent");
            tempParent.transform.position = e.Key.transform.position;
            List <Transform> children = new List <Transform>();
            for (int i = 0; i < e.Key.transform.childCount; i++)
            {
                if (e.Key.transform.GetChild(i).parent == e.Key.transform)
                {
                    children.Add(e.Key.transform.GetChild(i));
                }
            }
            foreach (Transform f in children)
            {
                f.parent = tempParent.transform;
            }
            tempParent.transform.rotation = Quaternion.AngleAxis(e.Value, Vector3.forward) * tempParent.transform.rotation;
            foreach (Transform f in children)
            {
                f.parent = e.Key.transform;
            }
            GameObject.Destroy(tempParent);
        }
    }