Пример #1
0
 public void Start()
 {
     gameObject.AddComponent(typeof(LevelLoader));
     levelLoader = GetComponent <LevelLoader>();
     haptics     = GetComponent <Haptics>();
     haptics.SetInputSource(leftHandRay ? SteamVR_Input_Sources.LeftHand : SteamVR_Input_Sources.RightHand);
 }
Пример #2
0
    void OnCollisionEnter(Collision collision)
    {
        Building building = collision.collider.gameObject.GetComponent <Building>();

        if (building == null || building.health <= 0)
        {
            return;
        }
        building.health -= 1;
        if (effect != null)
        {
            effect.transform.position = collision.contacts[0].point;
            effect.Emit(10);
        }
        Haptics.ProvideHaptics(hand, hapticAmountOnHit);
        if (building.health <= 0)
        {
            if (onDestroyBuilding != null)
            {
                onDestroyBuilding.Invoke();
            }
            for (int i = 0; i < collision.collider.gameObject.transform.childCount; ++i)
            {
                Rigidbody rb = collision.collider.gameObject.transform.GetChild(i).GetComponent <Rigidbody>();
                rb.isKinematic = false;
                rb.useGravity  = true;
            }
            collision.collider.enabled = false;
        }
    }
Пример #3
0
 // Start is called before the first frame update
 void Awake()
 {
     //Obtenemos el objeto de la mano de Steam VR y el joint.
     m_pose          = GetComponent <SteamVR_Behaviour_Pose>();
     m_joint         = GetComponent <FixedJoint>();
     m_hapticActions = GetComponent <Haptics>();
 }
Пример #4
0
 private void CreateTaskButton_Click(object sender, RoutedEventArgs e)
 {
     SoundFX.PlayFinishCreatingTaskSound();
     Haptics.ApplyCreateTaskButtonPressHaptics();
     ToDoTask.CreateNote(taskDetailsTextBox.Text);
     App.NavService.Navigate(typeof(MainPage));
 }
Пример #5
0
        public void Soft()
        {
            try
            {
                Thread t = new Thread(new ThreadStart(delegate()
                {
                    Haptics.HapticsNote[] _hapticsNotes = new Haptics.HapticsNote[1];
                    _hapticsNotes[0].magnitude          = 20;

                    _hapticsNotes[0].startingMagnitude = 0;
                    _hapticsNotes[0].startTimeDuration = 0;

                    _hapticsNotes[0].duration = 100;

                    _hapticsNotes[0].endTimeDuration = 0;
                    _hapticsNotes[0].endingMagnitude = 0;

                    _hapticsNotes[0].style  = Haptics.NoteStyle.Sharp;
                    _hapticsNotes[0].period = 2;

                    Haptics.PlayNotes(handle, 1, _hapticsNotes, false, null);
                }));
                t.Start();
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message, "Haptic.Soft");
            }
        }
Пример #6
0
        private async void CompletedStampToggleButton_Checked(object sender, RoutedEventArgs e)
        {
            await updateListedTaskFromCompletionResult();

            if (PageStuff.navigating == false)
            {
                Haptics.ApplyCompletedStampHaptics();
                SoundFX.PlayCompletedSound();
            }
        }
 private void GetController()
 {
     if (MLInput.IsStarted && connector?.ConnectedController != null)
     {
         Device = connector.ConnectedController;
         MLInput.OnControllerButtonDown += MLInput_OnControllerButtonDown;
         MLInput.OnControllerButtonUp   += MLInput_OnControllerButtonUp;
         Haptics.SetController(Device);
     }
 }
 public void OnDestroy()
 {
     if (IsConnected)
     {
         Haptics.SetController(null);
         CleanupConnector(false);
         MLInput.OnControllerButtonDown -= MLInput_OnControllerButtonDown;
         MLInput.OnControllerButtonUp   -= MLInput_OnControllerButtonUp;
         Device = null;
     }
 }
Пример #9
0
        private void AddTaskButton_Click(object sender, RoutedEventArgs e)
        {
            Haptics.ApplyAddTaskButtonPressHaptics();
            Frame.ContentTransitions = new TransitionCollection();
            var navThemeTransition = new NavigationThemeTransition
            {
                DefaultNavigationTransitionInfo = new EntranceNavigationTransitionInfo()
            };

            Frame.ContentTransitions.Add(navThemeTransition);
            App.NavService.Navigate(typeof(CreateTaskPage));
        }
Пример #10
0
 void Start()
 {
     temp             = null;
     hand             = gameObject.GetComponent <Rigidbody> ();
     goingFast        = false;
     previousPosition = gameObject.transform.position;
     if (SceneManager.GetActiveScene().name == "WackAMole")
     {
         molesScript = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GroundMoles> ();
     }
     haptics = GameObject.FindGameObjectWithTag("GameManager").GetComponent <Haptics> ();
 }
Пример #11
0
        private void TimerHit(object state)
        {
            Haptics.HapticsNote[] _hapticsNotes = new Haptics.HapticsNote[1];
            _hapticsNotes[0].magnitude = 20;

            _hapticsNotes[0].startingMagnitude = 0;
            _hapticsNotes[0].startTimeDuration = 0;

            _hapticsNotes[0].duration = 50;

            _hapticsNotes[0].endTimeDuration = 0;
            _hapticsNotes[0].endingMagnitude = 0;

            _hapticsNotes[0].style  = Haptics.NoteStyle.Sharp;
            _hapticsNotes[0].period = 50;

            Haptics.PlayNotes(handle, 1, _hapticsNotes, false, null);
        }
Пример #12
0
        public bool Play()
        {
            bool result = true;

#if SAMSUNG
            m_hapticsNotes[0].magnitude = 255;
            SmiResultCode r = Haptics.PlayNotes(m_hapticsHandle, 1, m_hapticsNotes, false, m_defaultHapticsNotification);

            return(r == SmiResultCode.Success);
#endif
            return(result);

            ////if (NativeMethods.VibratePlay(0, IntPtr.Zero, uint.MaxValue, uint.MaxValue) != 0)
            //if (NativeMethods.VibratePlay(0, IntPtr.Zero, 1, NativeMethods.INFINITE) != 0)
            //{
            //    return false;
            //}
            //return true;
        }
Пример #13
0
        private void CompletedStampToggleButton_Click(object sender, RoutedEventArgs e)
        {
            UpdateUIAutomation();

            if (TaskItem.IsCompleted == true)
            {
                Haptics.ApplyCompletedStampHaptics();
                SoundFX.PlayCompletedSound();
            }
            else
            {
                Haptics.ApplyEraseCompletedStampHaptics();
            }

            if (TaskItem != null)
            {
                ToDoTask.AcknowledgeIsCompletedStateChange(this.TaskItem.IsCompleted);
            }
            else
            {
                Debug.WriteLine("Crash Prevented! - Value of TaskItem was null");
            }
        }
Пример #14
0
        private bool InitHaptics()
        {
            bool result = true;

            if (Haptics.Open(ref m_hapticsHandle) != SmiResultCode.Success)
            {
                result = false;
            }
            else
            {
                m_hapticsNotes = new Haptics.HapticsNote[1];
                m_hapticsNotes[0].magnitude         = 255;
                m_hapticsNotes[0].startingMagnitude = 0;
                m_hapticsNotes[0].endingMagnitude   = 0;
                m_hapticsNotes[0].duration          = 50;
                m_hapticsNotes[0].endTimeDuration   = 0;
                m_hapticsNotes[0].startTimeDuration = 0;
                m_hapticsNotes[0].style             = Haptics.NoteStyle.Sharp;
                m_hapticsNotes[0].period            = 0;

                m_defaultHapticsNotification = DefaultNotification;
            }
            return(result);
        }
Пример #15
0
 private void AppBarButton_Click(object sender, RoutedEventArgs e)
 {
     Haptics.ApplyEraseCompletedStampHaptics();
     onScreenInput.TryHide();
     CreateTaskButton.Focus(FocusState.Programmatic);
 }
Пример #16
0
 void Awake()
 {
     Instance = this;
 }
Пример #17
0
        private async void CompletedStampToggleButton_Unchecked(object sender, RoutedEventArgs e)
        {
            await updateListedTaskFromCompletionResult();

            Haptics.ApplyEraseCompletedStampHaptics();
        }