Beispiel #1
0
    protected virtual void DrawPlayerManager()
    {
        EditorGUIUtility.LookLikeInspector();
        UNIPlayerManager manager = target as UNIPlayerManager;

        GUILayout.Label(manager.GetSelectionString());
        EditorGUILayout.Space();
        manager.m_settingManager = EditorGUILayout.ObjectField("Context", manager.m_settingManager, typeof(OpenNISettingsManager), true) as OpenNISettingsManager;
        int maxPlayers = EditorGUILayout.IntField("Max allowed players", manager.m_maxNumberOfPlayers);

        if (maxPlayers > 0)
        {
            if (EditorApplication.isPlaying)
            {
                //is running so we need to change manually
                manager.ChangeNumberOfPlayers(maxPlayers);
            }
            else
            {
                manager.m_maxNumberOfPlayers = maxPlayers;
            }
        }

        int numRetries = EditorGUILayout.IntField("Num Retries", manager.m_numRetries);

        if (numRetries > 0)
        {
            manager.m_numRetries = numRetries;
        }
    }
Beispiel #2
0
    // Use this for initialization
    void Start()
    {
        if (m_playerManager == null)
        {
            m_playerManager = FindObjectOfType(typeof(UNIPlayerManager)) as UNIPlayerManager;
        }

        m_basePos = new Rect(0, Screen.height / 2, 150, 30);
        if (m_actionToSelect == null)
        {
            m_actionToSelect = "";
        }
        m_actionToSelectRectWidth = m_actionToSelect.Length * 7;
    }
Beispiel #3
0
    // Use this for initialization
    void Start()
    {
        jointTransforms = m_jointTransforms;

        updateJointPositions = m_updateJointPositions;
        updateRootPosition   = m_updateRootPosition;
        updateOrientation    = m_updateOrientation;

        rotationDampening = m_rotationDampening;
        scale             = m_scale;
        speed             = m_speed;

        if (m_playerManager == null)
        {
            m_playerManager = FindObjectOfType(typeof(UNIPlayerManager)) as UNIPlayerManager;
        }
        if (m_playerManager == null)
        {
            throw new System.Exception("Must have a plyer manager to control the skeleton!");
        }
        int jointCount = Enum.GetNames(typeof(SkeletonJoint)).Length + 1;      //enum starts at 1

        m_jointsInitialRotations = new Quaternion[jointCount];
        //save all initial rotation
        //NOTE: Assumes skeleton mode is in 'T' pose since all rotations are relative to that pose
        foreach (SkeletonJoint joints in Enum.GetValues(typeof(SkeletonJoint)))
        {
            if ((int)joints >= m_jointTransforms.Length)
            {
                continue;
            }

            if (m_jointTransforms[(int)joints])
            {
                m_jointsInitialRotations[(int)joints] = Quaternion.Inverse(transform.rotation) * m_jointTransforms[(int)joints].rotation;
            }
        }
        m_originalRootPosition = transform.localPosition;
        //start out in calibration pose
        RotateToCalibrationPose();
    }