Beispiel #1
0
        void _body_arm_straight()
        {
            Head.goto_straight();
            SpineU.goto_straight();
            if (m_left_arm_active)
            {
                LUArm.goto_straight();
                LFArm.goto_straight();
                if (m_right_arm_active)
                {
                    RUArm.goto_straight();
                    RFArm.goto_straight();
                }
                else
                {
                    right_arm_freeze_state();
                }
            }
            else               // только m_right_arm_active
            {
                RUArm.goto_straight();
                RFArm.goto_straight();
                left_arm_freeze_state();
            }

            if (_spine_circle.enabled)
            {
                finish_roll();
            }
            if (m_relaxed)
            {
                m_relaxed = false;
            }
            if (m_arm_grouped)
            {
                m_arm_grouped = false;
            }
            _need_arm_act = e_need_action.nothing;
        }
Beispiel #2
0
        void _body_arm_group()
        {
            if (m_arm_grouped && m_leg_grouped)
            {
                roll(true);
            }
            else
            {
                if (m_left_arm_active)
                {
                    LUArm.goto_group();
                    LFArm.goto_group();

                    if (m_right_arm_active)
                    {
                        Head.goto_group();
                        SpineU.goto_group();
                        RUArm.goto_group();
                        RFArm.goto_group();
                    }
                }
                else if (m_right_arm_active)
                {
                    RUArm.goto_group();
                    RFArm.goto_group();
                }

                m_arm_grouped = true;
                if (m_leg_grouped)
                {
                    start_roll();
                }
            }
            if (m_relaxed)
            {
                m_relaxed = false;
            }
            _need_arm_act = e_need_action.nothing;
        }
Beispiel #3
0
        void _body_arm_direct()
        {
            if (_spine_circle.enabled)
            {
                finish_roll();
            }

            /*for (_iii = 0; _iii < 6; ++_iii)
             *  m_joints[_iii].direct(m_dir_arm);*/


            Head.apply_target_angle(0f);
            if (m_left_arm_active)
            {
                _aaa = custom_direct_arm(LUArm, LFArm, m_dir_arm);
                if (m_right_arm_active)
                {
                    RUArm.apply_target_angle(LUArm.target_angle);
                    RFArm.apply_target_angle(LFArm.target_angle);
                }
                else
                {
                    right_arm_freeze_state();
                }
            }
            else   // только m_right_arm_active
            {
                _aaa = custom_direct_arm(RUArm, RFArm, m_dir_arm);
                left_arm_freeze_state();
            }
            SpineU.apply_target_angle(_aaa, true);
            m_arm_grouped = false;
            if (m_relaxed)
            {
                m_relaxed = false;
            }
            _need_arm_act = e_need_action.nothing;
        }
Beispiel #4
0
        //\this being here will save GC allocs

        // initialization
        void Awake()
        {
            _update_action = new UnityAction[] {
                utils.empty_action,
                update_act__disabled_control,
                update_act__control
            };

            _spine        = transform.Find("SpineM").GetComponent <Rigidbody2D>();
            _spine_circle = _spine.GetComponent <CircleCollider2D>();
            _spine_box    = _spine.GetComponent <PolygonCollider2D>();
            _spine_xform  = _spine.transform;

            roll_grow_pos = roll_pos * roll_grow_speed / roll_radius;

            m_joints = new GymanJoint[13];

            foreach (GymanJoint j in GetComponentsInChildren <GymanJoint>())
            {
                if (j.gameObject.name == "LUArm")
                {
                    m_joints[0] = j;
                }
                else if (j.gameObject.name == "LFArm")
                {
                    m_joints[1] = j;
                }
                else if (j.gameObject.name == "RUArm")
                {
                    m_joints[2] = j;
                }
                else if (j.gameObject.name == "RFArm")
                {
                    m_joints[3] = j;
                }
                else if (j.gameObject.name == "Head")
                {
                    m_joints[4] = j;
                }
                else if (j.gameObject.name == "SpineU")
                {
                    m_joints[5] = j;
                }
                else if (j.gameObject.name == "SpineD")
                {
                    m_joints[6] = j;
                }
                else if (j.gameObject.name == "LThigh")
                {
                    m_joints[7] = j;
                }
                else if (j.gameObject.name == "LCalf")
                {
                    m_joints[8] = j;
                }
                else if (j.gameObject.name == "LFoot")
                {
                    m_joints[9] = j;
                }
                else if (j.gameObject.name == "RThigh")
                {
                    m_joints[10] = j;
                }
                else if (j.gameObject.name == "RCalf")
                {
                    m_joints[11] = j;
                }
                else if (j.gameObject.name == "RFoot")
                {
                    m_joints[12] = j;
                }
            }

            m_grab_left  = LFArm.GetComponent <GymanGrab>();
            m_grab_right = RFArm.GetComponent <GymanGrab>();

            m_foots    = new GymanFoot[4];
            m_foots[0] = LFoot.GetComponent <GymanFoot>();
            m_foots[1] = RFoot.GetComponent <GymanFoot>();

            refresh_update_num();
            body_relax();
            is_user_input = true;

            _current_magic_max_speed = magic_max_speed;
        }
Beispiel #5
0
 public void right_arm_freeze_state()
 {
     m_right_arm_active = false;
     RUArm.apply_target_angle(0f);
     RFArm.apply_target_angle(0f);
 }