Beispiel #1
0
 public void SetCommonField(PositionTag tag, float value)
 {
     foreach (var a in this.GetTagGroup(tag))
     {
         a.CommonField = value;
     }
 }
Beispiel #2
0
        public PositionTag FindBestMove(Node node)
        {
            Node        tmp      = choose_son(node);
            PositionTag position = new PositionTag(tmp.i, tmp.j);

            return(position);
        }
Beispiel #3
0
        public float GetCommonFieldSum(PositionTag tag)
        {
            float result = 0;

            foreach (var a in this.GetTagGroup(tag))
            {
                result += a.CommonField;
            }
            return(result);
        }
Beispiel #4
0
        public void Play(PositionTag posTag, float angleX, float offsetY)
        {
            var clip = GetClip(posTag);

            if (clip == null)
            {
                BhapticsLogger.LogInfo("Cannot find TactClip {0} {1} {2}", posTag, angleX, offsetY);
                return;
            }
            clip.Play(1f, 1f, angleX, offsetY * yOffsetMultiplier);
        }
Beispiel #5
0
        public IEnumerable <ILinkData> GetTagGroup(PositionTag tag)
        {
            List <ILinkData> list;

            if (this.tagGroupInt.TryGetValue(tag, out list))
            {
                return(list);
            }
            IEnumerable <ILinkData> result = this.childrenInt.SkipWhile(a => (a.PosTag & tag) == 0).TakeWhile(a => (a.PosTag & tag) != 0);

            this.tagGroupInt.Add(tag, result.ToList());
            return(result);
        }
Beispiel #6
0
        private void Play(PositionTag posTag, Vector3 contactPos, Vector3 targetPos, Vector3 targetForward, float targetHeight)
        {
            var angle   = 0f;
            var offsetY = 0f;

            if (posTag == PositionTag.Body)
            {
                Vector3 targetDir = contactPos - targetPos;
                angle   = BhapticsUtils.Angle(targetDir, targetForward);
                offsetY = (contactPos.y - targetPos.y) / targetHeight;
            }

            Play(posTag, angle, offsetY);
        }
Beispiel #7
0
        public void Play(PositionTag posTag, float angleX, float offsetY)
        {
            var clip = GetClip(posTag);

            if (clip == null)
            {
                Debug.Log("Cannot find TactSource");
                return;
            }
            clip.VestRotationAngleX  = angleX;
            clip.VestRotationOffsetY = offsetY * yOffsetMultiplier;

            clip.Play();
        }
Beispiel #8
0
        private HapticClip GetClip(PositionTag posTag)
        {
            switch (posTag)
            {
            case PositionTag.Body:
                if (BodyClips != null && BodyClips.Length > 0)
                {
                    int randIndex = Random.Range(0, BodyClips.Length);
                    return(BodyClips[randIndex]);
                }
                break;

            case PositionTag.Head:
                if (HeadClips != null && HeadClips.Length > 0)
                {
                    int randIndex = Random.Range(0, HeadClips.Length);
                    return(HeadClips[randIndex]);
                }
                break;

            case PositionTag.RightArm:
                if (RightArmClips != null && RightArmClips.Length > 0)
                {
                    int randIndex = Random.Range(0, RightArmClips.Length);
                    return(RightArmClips[randIndex]);
                }
                break;

            case PositionTag.LeftArm:
                if (LeftArmClips != null && LeftArmClips.Length > 0)
                {
                    int randIndex = Random.Range(0, LeftArmClips.Length);
                    return(LeftArmClips[randIndex]);
                }
                break;
            }

            if (DefaultClips != null && DefaultClips.Length > 0)
            {
                int randIndex = Random.Range(0, DefaultClips.Length);
                return(DefaultClips[randIndex]);
            }


            return(null);
        }
Beispiel #9
0
        private TactSource GetClip(PositionTag posTag)
        {
            TactSource source = DefaultSource;

            switch (posTag)
            {
            case PositionTag.Body:
                if (BodySources != null && BodySources.Length > 0)
                {
                    int randIndex = Random.Range(0, BodySources.Length);
                    source = BodySources[randIndex];
                }
                break;

            case PositionTag.Head:
                if (HeadSources != null && HeadSources.Length > 0)
                {
                    int randIndex = Random.Range(0, HeadSources.Length);
                    source = HeadSources[randIndex];
                }
                break;

            case PositionTag.RightArm:
                if (RightArmSources != null && RightArmSources.Length > 0)
                {
                    int randIndex = Random.Range(0, RightArmSources.Length);
                    source = RightArmSources[randIndex];
                }
                break;

            case PositionTag.LeftArm:
                if (LeftArmSources != null && LeftArmSources.Length > 0)
                {
                    int randIndex = Random.Range(0, LeftArmSources.Length);
                    source = LeftArmSources[randIndex];
                }
                break;
            }

            return(source);
        }
Beispiel #10
0
        public void Play(PositionTag posTag, RaycastHit hit)
        {
            var col = hit.collider;

            Play(posTag, hit.point, col.transform.position, col.transform.forward, col.bounds.size.y);
        }
Beispiel #11
0
 public void Play(PositionTag posTag, Vector3 contactPos, Collider targetCollider)
 {
     Play(posTag, contactPos, targetCollider.transform.position, targetCollider.transform.forward, targetCollider.bounds.size.y);
 }
Beispiel #12
0
 public void Play(PositionTag posTag = PositionTag.Default)
 {
     Play(posTag, 0, 0);
 }
 private float GetMoveOffset(PositionTag tag)
 {
     return(this.linkable.GroupParent.GetCommonFieldSum(tag));
 }