Ejemplo n.º 1
0
    private void OnThrowEnded()
    {
        Debug.Log("Throw ending");

        AnimatorEnabled = false;
        IKEnabled       = true;

        _ikSolver.GetChain(0).RestoreDefaultPose(false);

        _animator.SetBool("throwingLeft", false);
        _animator.SetBool("throwingRight", false);

        SetState(RobotState.Idle);
    }
        public override void OnInspectorGUI()
        {
            IKChain2D chain = m_Solver.GetChain(0);

            serializedObject.Update();
            EditorGUILayout.PropertyField(m_TargetProperty, Contents.targetLabel);
            EditorGUILayout.PropertyField(m_EffectorProperty, Contents.effectorLabel);
            EditorGUILayout.IntSlider(m_TransformCountProperty, 0, IKUtility.GetMaxChainCount(chain), Contents.chainLengthLabel);
            EditorGUILayout.PropertyField(m_IterationsProperty, Contents.iterationsLabel);
            EditorGUILayout.PropertyField(m_ToleranceProperty, Contents.toleranceLabel);
            EditorGUILayout.PropertyField(m_VelocityProperty, Contents.velocityLabel);

            DrawCommonSolverInspector();
            serializedObject.ApplyModifiedProperties();
        }
        public void Setup()
        {
            go = new GameObject();
            var child1GO = new GameObject();

            child1GO.transform.parent = go.transform;

            var child2GO = new GameObject();

            child2GO.transform.parent = child1GO.transform;

            var child3GO = new GameObject();

            child3GO.transform.parent = child2GO.transform;

            effectorGO = new GameObject();
            effectorGO.transform.parent = child3GO.transform;

            go.transform.position         = Vector3.zero;
            child1GO.transform.position   = new Vector3(1.0f, 0.0f, 0.0f);
            child2GO.transform.position   = new Vector3(3.0f, 0.0f, 0.0f);
            child3GO.transform.position   = new Vector3(6.0f, 0.0f, 0.0f);
            effectorGO.transform.position = new Vector3(10.0f, 0.0f, 0.0f);

            ikGO    = new GameObject();
            manager = ikGO.AddComponent <IKManager2D>();
            var lsGO = new GameObject();

            solver = lsGO.AddComponent <CCDSolver2D>();
            lsGO.transform.parent = ikGO.transform;

            targetGO = new GameObject();
            targetGO.transform.parent = solver.transform;

            chain                = solver.GetChain(0);
            chain.effector       = effectorGO.transform;
            chain.target         = targetGO.transform;
            chain.transformCount = 5;

            solver.Initialize();

            manager.AddSolver(solver);
        }