Beispiel #1
0
        internal void ClearDanAgent()
        {
            m_danPointsFound   = false;
            m_bpDanPointsFound = false;

            if (m_danPoints != null)
            {
                m_danPoints.ResetDanPoints();
            }
            m_danPoints = null;

            if (m_danColliders != null)
            {
                foreach (var danCollider in m_danColliders)
                {
                    UnityEngine.Object.Destroy(danCollider);
                }
            }

            m_danColliders = new List <DynamicBoneCollider>();

#if !HS2_STUDIO && !AI_STUDIO
            ClearTarget();

            UnityEngine.Object.Destroy(m_indexCollider);
            UnityEngine.Object.Destroy(m_middleCollider);
            UnityEngine.Object.Destroy(m_ringCollider);
#endif
        }
Beispiel #2
0
        private void Initialize(ChaControl character, DanOptions options)
        {
            ClearDanAgent();

            if (character == null)
            {
                return;
            }

            m_danOptions   = options;
            m_danCharacter = character;

            Transform        danTop        = m_danCharacter.GetComponentsInChildren <Transform>().FirstOrDefault(x => x.name != null && x.name.Contains(BoneNames.DanTop));
            List <Transform> danTransforms = new List <Transform>();

            foreach (var boneName in BoneNames.DanBones)
            {
                Transform danBone = m_danCharacter.GetComponentsInChildren <Transform>().FirstOrDefault(x => x.name != null && x.name.Contains(boneName));
                if (danBone != null)
                {
                    danTransforms.Add(danBone);
                }
            }

            if (danTop == null || danTransforms.Count < 2)
            {
                return;
            }

            if (danTransforms.Count == BoneNames.DanBones.Count)
            {
                m_bpDanPointsFound = true;
            }

            m_danPoints             = new DanPoints(danTransforms, danTop);
            m_danPointsFound        = true;
            m_baseDanLength         = DefaultDanLength * m_danPoints.GetDanLossyScale();
            m_baseSectionHalfLength = m_baseDanLength / (2 * (m_danPoints.danPoints.Count - 1));

            for (int danPoint = 1; danPoint < m_danPoints.danPoints.Count; danPoint++)
            {
                m_danColliders.Add(InitializeCollider(m_danPoints.danPoints[danPoint - 1].transform, m_danOptions.danRadius * m_danPoints.danPoints[danPoint].defaultLossyScale.x, ((m_baseSectionHalfLength + m_danOptions.danHeadLength) * 2),
                                                      DynamicBoneCollider.Direction.Z, m_danOptions.danVerticalCenter, m_baseSectionHalfLength));
            }

#if !HS2_STUDIO && !AI_STUDIO
            UpdateFingerColliders(m_danOptions.fingerRadius, m_danOptions.fingerLength);
#endif

            Console.WriteLine("Dan Found " + m_danPointsFound);
            Console.WriteLine("BP Dan Found " + m_bpDanPointsFound);
        }
Beispiel #3
0
        private void InitializeDan()
        {
            List <Transform> danTransforms = new List <Transform>();

            foreach (var boneName in BoneNames.DanBones)
            {
                Transform danBone = m_danCharacter.GetComponentsInChildren <Transform>().FirstOrDefault(x => x.name != null && x.name.Contains(boneName));
                if (danBone != null)
                {
                    danTransforms.Add(danBone);
                }
            }

            Transform tamaTop = m_danCharacter.GetComponentsInChildren <Transform>().FirstOrDefault(x => x.name != null && x.name.Contains(BoneNames.TamaTop));

            if (tamaTop == null || danTransforms.Count < 2)
            {
                return;
            }

            if (danTransforms.Count == BoneNames.DanBones.Count)
            {
                m_bpDanPointsFound = true;
            }

            m_danPoints      = new DanPoints(danTransforms, tamaTop);
            m_danPointsFound = true;

            m_baseDanLength         = DefaultDanLength * m_danPoints.GetDanLossyScale();
            m_baseSectionHalfLength = m_baseDanLength / (2 * (m_danPoints.danPoints.Count - 1));

            for (int danPoint = 1; danPoint < m_danPoints.danPoints.Count; danPoint++)
            {
                m_danColliders.Add(InitializeCollider(m_danPoints.danPoints[danPoint - 1].transform, m_danOptions.danRadius * m_danPoints.danPoints[danPoint].defaultLossyScale.x, ((m_baseSectionHalfLength + m_danOptions.danHeadLength) * 2),
                                                      new Vector3(0, m_danOptions.danVerticalCenter, m_baseSectionHalfLength), DynamicBoneCollider.Direction.Z));
            }
        }