Exemplo n.º 1
0
    public void UpdateParents( KinectPuppet puppet )
    {
        Transform parent;

        switch( m_BodyPart )
        {
            case KinectPuppet_Manager.BodyPartType.Head:
                parent = puppet.m_PuppetParts[(int)KinectPuppet_Manager.BodyPartType.UpperTorso].m_EndPivot;
                break;
            case KinectPuppet_Manager.BodyPartType.UpperTorso:
                parent = puppet.transform;
                break;
            case KinectPuppet_Manager.BodyPartType.LowerTorso:
                parent = puppet.transform;
                break;
            case KinectPuppet_Manager.BodyPartType.LegLeftUpper:
                parent = puppet.m_PuppetParts[(int)KinectPuppet_Manager.BodyPartType.LowerTorso].m_LeftPivot;
                break;
            case KinectPuppet_Manager.BodyPartType.LegLeftLower:
                parent = puppet.m_PuppetParts[(int)KinectPuppet_Manager.BodyPartType.LegLeftUpper].m_EndPivot;
                break;
            case KinectPuppet_Manager.BodyPartType.FootLeft:
                parent = puppet.m_PuppetParts[(int)KinectPuppet_Manager.BodyPartType.LegLeftLower].m_EndPivot;
                break;
            case KinectPuppet_Manager.BodyPartType.LegRightUpper:
                parent = puppet.m_PuppetParts[(int)KinectPuppet_Manager.BodyPartType.LowerTorso].m_RightPivot;
                break;
            case KinectPuppet_Manager.BodyPartType.LegRightLower:
                parent = puppet.m_PuppetParts[(int)KinectPuppet_Manager.BodyPartType.LegRightUpper].m_EndPivot;
                break;
            case KinectPuppet_Manager.BodyPartType.FootRight:
                parent = puppet.m_PuppetParts[(int)KinectPuppet_Manager.BodyPartType.LegRightLower].m_EndPivot;
                break;
            case KinectPuppet_Manager.BodyPartType.ArmLeftUpper:
                parent = puppet.m_PuppetParts[(int)KinectPuppet_Manager.BodyPartType.UpperTorso].m_LeftPivot;
                break;
            case KinectPuppet_Manager.BodyPartType.ArmLeftLower:
                parent = puppet.m_PuppetParts[(int)KinectPuppet_Manager.BodyPartType.ArmLeftUpper].m_EndPivot;
                break;
            case KinectPuppet_Manager.BodyPartType.ArmRightUpper:
                parent = puppet.m_PuppetParts[(int)KinectPuppet_Manager.BodyPartType.UpperTorso].m_RightPivot;
                break;
            case KinectPuppet_Manager.BodyPartType.ArmRightLower:
                parent = puppet.m_PuppetParts[(int)KinectPuppet_Manager.BodyPartType.ArmRightUpper].m_EndPivot;
                break;
            case KinectPuppet_Manager.BodyPartType.Accessory0:
                parent = puppet.m_PuppetParts[(int)KinectPuppet_Manager.BodyPartType.ArmRightUpper].m_EndPivot;
                break;
            case KinectPuppet_Manager.BodyPartType.Accessory1:
                parent = puppet.m_PuppetParts[(int)KinectPuppet_Manager.BodyPartType.ArmRightUpper].m_EndPivot;
                break;
            default:
                parent = null;
                break;
        }

        m_Parent = parent;
        UpdateTransform();
    }
	// Use this for initialization
	void Start () 
    {
        m_Head = GameObject.Find( name + "/Head").transform;
        m_Neck = GameObject.Find(name + "/Neck").transform;
        m_SpineBase = GameObject.Find(name + "/SpineBase").transform;
        m_SpineMid = GameObject.Find(name + "/SpineMid").transform;

        m_ShoulderLeft = GameObject.Find(name + "/ShoulderLeft").transform;
        m_ElbowLeft = GameObject.Find(name + "/ElbowLeft").transform;
        m_WristLeft = GameObject.Find(name + "/WristLeft").transform;

        m_ShoulderRight = GameObject.Find(name + "/ShoulderRight").transform;
        m_ElbowRight = GameObject.Find(name + "/ElbowRight").transform;
        m_WristRight = GameObject.Find(name + "/WristRight").transform;

        m_Puppet = GameObject.Find("Puppet").GetComponent< KinectPuppet >();
	}