コード例 #1
0
ファイル: TactSource.cs プロジェクト: lsl013/haptic-library
        public void Play(ScaleOption option = null)
        {
            if (option == null)
            {
                option = new ScaleOption(Intensity, Duration);
            }
            switch (FeedbackType)
            {
            case FeedbackType.DotMode:
                if (DotPoints == null)
                {
                    Debug.LogError("DotPoints not defined");
                    return;
                }
                player.Submit(_key, ToPositionType(Position), DotPoints, TimeMillis);
                break;

            case FeedbackType.PathMode:
                if (Points == null)
                {
                    Debug.LogError("Points not defined");
                    return;
                }
                player.Submit(_key, ToPositionType(Position), new List <PathPoint>(Convert(Points)), TimeMillis);
                break;

            case FeedbackType.TactFile:
                if (currentFeedbackFileKey != FeedbackFile.Id)
                {
                    currentFeedbackFileKey = FeedbackFile.Id;
                    player.RegisterTactFileStr(currentFeedbackFileKey, FeedbackFile.Value);
                }

                if (FeedbackFile.Type == BhapticsUtils.TypeVest || FeedbackFile.Type == BhapticsUtils.TypeTactot)
                {
                    player.SubmitRegisteredVestRotation(currentFeedbackFileKey, _key,
                                                        new RotationOption(VestRotationAngleX + TactFileOffsetX, VestRotationOffsetY + TactFileOffsetY),
                                                        option);
                }
                else if (IsReflectTactosy && (FeedbackFile.Type == BhapticsUtils.TypeTactosy ||
                                              FeedbackFile.Type == BhapticsUtils.TypeTactosy2))
                {
                    var reflectKey = FeedbackFile.Id + "Reflect";
                    if (currentFeedbackFileKeyReflect != reflectKey)
                    {
                        player.RegisterTactFileStrReflected(reflectKey,
                                                            FeedbackFile.Value);
                        currentFeedbackFileKeyReflect = reflectKey;
                    }
                    player.SubmitRegistered(reflectKey, _key, option);
                }
                else
                {
                    player.SubmitRegistered(currentFeedbackFileKey, _key, option);
                }

                break;
            }
        }
コード例 #2
0
        public void Play(ScaleOption option = null)
        {
            if (option == null)
            {
                option = new ScaleOption(Intensity, Duration);
            }
            switch (FeedbackType)
            {
            case FeedbackType.DotMode:
                if (DotPoints == null)
                {
                    Debug.LogError("DotPoints not defined");
                    return;
                }
                player.Submit(_key, ToPositionType(Position), DotPoints, TimeMillis);
                break;

            case FeedbackType.PathMode:
                if (Points == null)
                {
                    Debug.LogError("Points not defined");
                    return;
                }
                player.Submit(_key, ToPositionType(Position), new List <PathPoint>(Convert(Points)), TimeMillis);
                break;

            case FeedbackType.TactFile:
                if (!isOriginFileRegistered)
                {
                    isOriginFileRegistered = true;
                    player.RegisterTactFileStr(FeedbackFile.Id, FeedbackFile.Value);
                }

//#if UNITY_EDITOR_WIN
//                    // WHEN CHANGED // TODO
                player.RegisterTactFileStr(FeedbackFile.Id, FeedbackFile.Value);
//#endif

                if (FeedbackFile.Type == BhapticsUtils.TypeVest || FeedbackFile.Type == BhapticsUtils.TypeTactot)
                {
                    player.SubmitRegisteredVestRotation(FeedbackFile.Id, _key,
                                                        new RotationOption(VestRotationAngleX + TactFileOffsetX, VestRotationOffsetY + TactFileOffsetY),
                                                        option);
                }
                else if (IsReflectTactosy && (FeedbackFile.Type == BhapticsUtils.TypeTactosy ||
                                              FeedbackFile.Type == BhapticsUtils.TypeTactosy2))
                {
                    var reflectKey = FeedbackFile.Id + "Reflect";
                    if (!isRegistered)
                    {
                        isRegistered = true;
                        player.RegisterTactFileStrReflected(reflectKey,
                                                            FeedbackFile.Value);
                    }
                    player.SubmitRegistered(reflectKey, _key, option);
                }
                else
                {
                    player.SubmitRegistered(FeedbackFile.Id, _key, option);
                }

                break;
            }
        }