예제 #1
0
 private void OnGUI()
 {
     if (GUI.Button(new Rect(100, 100, 100, 100), "Play Heartbeat"))
     {
         heartbeat.Play(AreaFlag.Chest_Left);
     }
 }
예제 #2
0
 private void OnGUI()
 {
     if (GUI.Button(new Rect(100, 100, 100, 100), "Play Haptic"))
     {
         jolt.Play(AreaFlag.All_Areas);
     }
 }
예제 #3
0
 void Start()
 {
     seq = new HapticSequence();
     //By using a double click we can distinctly hear the difference.
     seq.LoadFromAsset("Haptics/double_click");
     //Play it on load to make sure it loaded.
     seq.Play(AreaFlag.All_Areas);
 }
예제 #4
0
        private void StingPlayer()
        {
            var Where = HardlightSuit.Find().FindRandomLocation().Where;

            sting.Play(Where);

            float floor   = Mathf.Max(.02f, .75f * (1 - beeCount / 500));
            float ceiling = Mathf.Max(.25f, 1.3f * (1 - beeCount / 500));

            stingCounter += UnityEngine.Random.Range(floor, ceiling);
            //Debug.Log(floor + "  " + ceiling + "  " + stingCounter + "\n", this);
        }
예제 #5
0
        /// <summary>
        /// This should sound like the curve and then a double click after N seconds
        /// </summary>
        /// <returns>This is a coroutine.</returns>
        IEnumerator DirectToRetainSwitchTest(float interruptAtTime = 1.5f)
        {
            //Start the curve
            curve.Play();

            yield return(new WaitForSeconds(interruptAtTime));

            //Stop the curve
            curve.Stop();

            //Immediately play the file haptic. This should trigger a switch to Retained Mode.
            seq.Play(AreaFlag.All_Areas);
        }
        void Update()
        {
            //IF we should shock and we aren't currently
            if (ShouldShock && !CurrentlyShocking)
            {
                //Start the coroutine!
                StartCoroutine(ShockPlayer());
                ShouldShock = false;
            }

            if (Input.GetKeyDown(KeyCode.G))
            {
                HapticSequence seq = new HapticSequence();
                seq.LoadFromAsset("Haptics/pulse");
                seq.Play(AreaFlag.Left_All);
            }
        }
예제 #7
0
        void Update()
        {
            bool  moving = false;
            float velVal = 350;

            #region Direction Controls
            if (Input.GetKey(KeyCode.LeftArrow) && myRB.transform.position.x > -8)
            {
                myRB.AddForce(Vector3.left * velVal);
            }
            if (Input.GetKey(KeyCode.RightArrow) && myRB.transform.position.x < 8)
            {
                myRB.AddForce(Vector3.right * velVal);
            }
            if (Input.GetKey(KeyCode.UpArrow) && myRB.transform.position.y < 8)
            {
                myRB.AddForce(Vector3.up * velVal);
            }
            if (Input.GetKey(KeyCode.DownArrow) && myRB.transform.position.y > -8)
            {
                myRB.AddForce(Vector3.down * velVal);
            }

            if (!moving)
            {
                myRB.velocity = Vector3.zero;
            }
            #endregion

            #region Application Quit Code
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                Application.Quit();
            }
            #endregion

            if (Input.GetKeyDown(KeyCode.T))
            {
                var s = new HapticSequence();
                s.AddEffect(0.0, new HapticEffect(Effect.Click));
                s.Play(AreaFlag.Left_All);
                long milliseconds = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
                Debug.Log("Milliseconds: " + milliseconds);
            }
        }
예제 #8
0
        public void Dig()
        {
            //Debug.Log("Attempted Dig\n", this);
            //Are we held.
            //if (IsGrabbed())
            //{
            HapticSequence seq = new HapticSequence();

            seq.AddEffect(.25f, new HapticEffect(Effect.Buzz));
            AreaFlag Where = PrimaryLeft ? AreaFlag.Forearm_Left : AreaFlag.Forearm_Right;

            seq.Play(Where);
            //}
            Digged = true;

            leftActions.TriggerDecayingHapticPulse(1f, .5f, .02f, .8f);
            rightActions.TriggerDecayingHapticPulse(1f, .5f, .02f, .8f);
        }
        void Update()
        {
            if (start != null && end != null)
            {
                startLocation = start.transform.position;
                endLocation   = end.transform.position;
                direction     = endLocation - startLocation;
                if (Application.isPlaying)
                {
                    var Where = suit.HapticSphereCastForAreas(startLocation, direction, sphereCastRadius, 100);

                    var singles = Where.ToArray();
                    //string result = string.Empty;
                    //for (int i = 0; i < singles.Length; i++)
                    //{
                    //	result += singles[i] + " ";
                    //}
                    //Debug.Log("Sphere Cast currently hitting [" + singles.Length + "] areas : " + result + "\n", this);
                    mySequence.Play(Where);
                }
            }
        }