Esempio n. 1
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);
        }
Esempio n. 2
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));
            }
        }
Esempio n. 3
0
        internal void SetDanTarget(Vector3 enterTarget, Vector3 endTarget)
        {
            if (!m_danPointsFound)
            {
                return;
            }

            Vector3 danStartPosition = m_danPoints.GetDanStartPosition();

            float danDistanceToTarget = Vector3.Distance(danStartPosition, enterTarget);
            float adjustedDanLength   = GetSquishedDanLength(danDistanceToTarget);
            float girthScaleFactor    = GetSquishedDanGirth(danDistanceToTarget);

            m_danPoints.SquishDanGirth(girthScaleFactor);
            adjustedDanLength = GetMaxDanLength(adjustedDanLength, enterTarget, endTarget, danDistanceToTarget);
            //          m_danPoints.ScaleDanPoints(adjustedDanLength / m_baseDanLength);
            ScaleDanColliders(adjustedDanLength);

            List <Vector3> adjustedDanPoints = AdjustDanPointsToTargets(enterTarget, endTarget, adjustedDanLength, danDistanceToTarget);

            m_danPoints.AimDanPoints(adjustedDanPoints);

            m_danPoints.GetDanLossyScale();
        }