示例#1
0
        private void ControlRagDoll(bool enable)
        {
            RagDollList.Clear();

            _characterP3.GetComponentsInChildren(RagDollList);
            foreach (var v in RagDollList)
            {
                v.detectCollisions = enable;
                v.isKinematic      = !enable;
            }

            RagDollColliderList.Clear();
            _characterP3.GetComponentsInChildren(RagDollColliderList);
            var hitboxList = _hitboxHandler.GetHitBox().Values;

            foreach (var v in RagDollColliderList)
            {
                if (hitboxList.Contains(v))
                {
                    continue;
                }
                v.enabled = enable;
            }

            if (!enable)
            {
                ResetRagDollRootBoneTransform();
            }
        }
        public void SetActive(bool active)
        {
            foreach (var item in _handler.GetHitBox())
            {
                if (item.Value != null)
                {
                    item.Value.enabled = active;
                }
            }

            foreach (var item in _handler.GetRigidBobies())
            {
                if (item.Value != null)
                {
                    item.Value.detectCollisions = active;
                }
            }
        }