Пример #1
0
        private void InitHandle(IKHandle handle, Human human)
        {
            handle.transform.SetParent(human.transform, false);
            handle.SetVisible(_visible);

            _handles.Add(handle);
        }
Пример #2
0
        public void OnUpdate()
        {
            if (_scene)
            {
                if (_scene.StyleMgr.nowStyle != _currentStyle)
                {
                    _currentStyle = _scene.StyleMgr.nowStyle;
                    CleanScene();

                    if (_mode != MaestroMode.None)
                    {
                        MakeBipeds();
                    }
                }

                if (_visible)
                {
                    if (Input.GetMouseButtonDown(0))
                    {
                        IKHandle handle = null;

                        if (_moveHandleKey.Check(false))
                        {
                            handle = _handles[_currentKeyboardHandle];
                        }
                        else
                        {
                            handle = GetIKHandle();
                        }

                        if (handle)
                        {
                            handle.OnMouseDown(0);
                        }
                    }
                    else if (Input.GetMouseButtonDown(1))
                    {
                        IKHandle handle = null;

                        if (_moveHandleKey.Check(false))
                        {
                            handle = _handles[_currentKeyboardHandle];
                        }
                        else
                        {
                            handle = GetIKHandle();
                        }

                        if (handle)
                        {
                            handle.OnMouseDown(1);
                        }
                    }
                    else if (Input.GetMouseButtonUp(2))
                    {
                        IKHandle handle = null;

                        if (_moveHandleKey.Check(false))
                        {
                            handle = _handles[_currentKeyboardHandle];
                        }
                        else
                        {
                            handle = GetIKHandle();
                        }

                        if (handle)
                        {
                            handle.Reset();
                        }
                    }
                }

                if (_nextHandleKey.Check())
                {
                    var handle = _handles[_currentKeyboardHandle];
                    if (handle)
                    {
                        handle.Deselect();
                    }

                    _currentKeyboardHandle++;

                    if (_currentKeyboardHandle >= _handles.Count)
                    {
                        _currentKeyboardHandle = 0;
                    }

                    handle = _handles[_currentKeyboardHandle];
                    if (handle)
                    {
                        handle.Select();
                    }
                }

                if (_prevHandleKey.Check())
                {
                    var handle = _handles[_currentKeyboardHandle];
                    if (handle)
                    {
                        handle.Deselect();
                    }

                    _currentKeyboardHandle--;

                    if (_currentKeyboardHandle < 0)
                    {
                        _currentKeyboardHandle = _handles.Count - 1;
                    }

                    handle = _handles[_currentKeyboardHandle];
                    if (handle)
                    {
                        handle.Select();
                    }
                }

                if (_toggleMaestroKey.Check())
                {
                    if (_mode == MaestroMode.FBBIK)
                    {
                        _visible = !_visible;
                        UpdateHandleVisibility();
                    }
                    else if (_mode == MaestroMode.BIK)
                    {
                        CleanScene();

                        _mode    = MaestroMode.FBBIK;
                        _visible = true;

                        MakeBipeds();
                    }
                    else if (_mode == MaestroMode.None)
                    {
                        _visible = true;
                        _mode    = MaestroMode.FBBIK;
                        MakeBipeds();
                    }
                }

                if (_toggleSimpleMaestroKey.Check())
                {
                    if (_mode == MaestroMode.BIK)
                    {
                        _visible = !_visible;
                        UpdateHandleVisibility();
                    }
                    else if (_mode == MaestroMode.FBBIK)
                    {
                        CleanScene();

                        _mode    = MaestroMode.BIK;
                        _visible = true;

                        MakeBipeds();
                    }
                    else if (_mode == MaestroMode.None)
                    {
                        _visible = true;
                        _mode    = MaestroMode.BIK;
                        MakeBipeds();
                    }
                }
            }
        }