예제 #1
0
        private HapticHandle CreateHandle(SideOfHaptic side)
        {
            HapticHandle handle = null;

            if (TypeOfPlayable == PlayableType.Sequence)
            {
                HapticSequence seq = new HapticSequence();
                seq.LoadFromAsset(PlayableResourceName);

                var areaFlag = side == SideOfHaptic.Left ? Where.Mirror() : Where;
                handle = seq.CreateHandle(areaFlag);
            }
            else if (TypeOfPlayable == PlayableType.Pattern)
            {
                HapticPattern pat = new HapticPattern();
                pat.LoadFromAsset(PlayableResourceName);
                handle = pat.CreateHandle();
            }
            else if (TypeOfPlayable == PlayableType.Experience)
            {
                HapticExperience exp = new HapticExperience();
                exp.LoadFromAsset(PlayableResourceName);
                handle = exp.CreateHandle();
            }
            else if (TypeOfPlayable == PlayableType.Impulse)
            {
                return(CreateImpulseHandle(side));
            }

            return(handle);
        }
예제 #2
0
        private HapticHandle CreateImpulseHandle(SideOfHaptic side)
        {
            if (TypeOfImpulse == ImpulseType.None)
            {
                return(null);
            }
            else if (TypeOfImpulse == ImpulseType.Emanation)
            {
                bool mirror  = side == SideOfHaptic.Left;
                var  impulse = ImpulseGenerator.BeginEmanatingEffect(mirror ? StartLocation.Mirror() : StartLocation, depth);

                HapticSequence seq = new HapticSequence();
                seq.LoadFromAsset(HapticSequence);

                impulse.WithEffect(seq).WithAttenuation(attenuationPercentage).WithDuration(Duration);

                return(impulse.Play());
            }
            else if (TypeOfImpulse == ImpulseType.Traversal)
            {
                bool mirror  = side == SideOfHaptic.Left;
                var  impulse = ImpulseGenerator.BeginTraversingImpulse(
                    mirror ? StartLocation.Mirror() : StartLocation,
                    mirror ? EndLocation.Mirror() : EndLocation);

                HapticSequence seq = new HapticSequence();
                seq.LoadFromAsset(HapticSequence);

                impulse.WithEffect(seq).WithAttenuation(attenuationPercentage).WithDuration(Duration);

                return(impulse.Play());
            }
            return(null);
        }
예제 #3
0
        IEnumerator StomacheRumble()
        {
            gulpSource.volume = .85f;

            List <AreaFlag> locs = new List <AreaFlag>();

            locs.Add(AreaFlag.Lower_Ab_Left);
            locs.Add(AreaFlag.Lower_Ab_Right);
            locs.Add(AreaFlag.Mid_Ab_Left);
            locs.Add(AreaFlag.Mid_Ab_Right);

            while (true)
            {
                AreaFlag loc  = locs[Random.Range(0, locs.Count)];
                string   file = Random.Range(0, 1.0f) > .8f ? "Haptics/StomachRumbleHeavy" : "Haptics/StomachRumble";

                HapticSequence seq = new HapticSequence();
                seq.LoadFromAsset(file);
                seq.CreateHandle(loc).Play();

                float waitDur = Random.Range(.05f, .15f);

                yield return(new WaitForSeconds(waitDur));
            }
        }
예제 #4
0
        /// <summary>
        /// [Helper function] Looks for a haptic sequence File - "Resources/Haptics/" + filename
        /// Identical to making a new HapticSequence and calling it's LoadFromAsset("Haptics/" + filename) function
        /// </summary>
        /// <param name="sequenceFile"></param>
        /// <returns></returns>
        public HapticSequence GetSequence(string sequenceFile)
        {
            HapticSequence seq = new HapticSequence();

            seq.LoadFromAsset("Haptics/" + sequenceFile);
            return(seq);
        }
예제 #5
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);
 }
        void Start()
        {
            suit = HardlightSuit.Find();
            mySequence.LoadFromAsset(sequenceFileName);
            handleList = new List <HapticHandle>();

            if (SpherecastStartObject == null)
            {
                Debug.LogError("[Haptic Spherecast] - [" + name + "] has a null object for where it should begin.\n", this);
            }
        }
예제 #7
0
 private void Start()
 {
     hapticOnDrawback.LoadFromAsset(drawHaptic);
     hapticOnRelease.LoadFromAsset(releaseHaptic);
     hapticwhilePulled.LoadFromAsset(pulledHapticName);
     pulledHandle = hapticwhilePulled.CreateHandle();
     bowAnimation = GetComponent <BowAnimation>();
     handle       = GetComponentInChildren <BowHandle>();
     interact     = GetComponent <VRTK_InteractableObject>();
     interact.InteractableObjectGrabbed += new InteractableObjectEventHandler(DoObjectGrab);
 }
예제 #8
0
 void Start()
 {
     if (hapticFilesToPlay == null)
     {
         hapticFilesToPlay = new string[0];
     }
     sequences = new HapticSequence[hapticFilesToPlay.Length];
     for (int i = 0; i < hapticFilesToPlay.Length; i++)
     {
         HapticSequence seq = new HapticSequence();
         seq.LoadFromAsset(hapticFilesToPlay[i]);
         sequences[i] = seq;
     }
 }
        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);
            }
        }
예제 #10
0
        void Start()
        {
            explosionSequence.LoadFromAsset(hapticSequenceName);
            if (CreateAudioSFX)
            {
                if (source == null)
                {
                    source = GetComponent <AudioSource>();
                    if (source == null)
                    {
                        source = gameObject.AddComponent <AudioSource>();
                    }
                }

                source.clip    = AudioManager.Inst.FindOrLoadAudioClip(sfxName);
                source.volume  = sfxVolume;
                source.enabled = true;
            }
        }
예제 #11
0
 public void SetTriggerSequence(string sequenceName, string visibleName)
 {
     //HapticSequence newSeq = new HapticSequence();
     try
     {
         LastSequence = new HapticSequence();
         LastSequence.LoadFromAsset(sequenceName);
         greenBox.SetSequence(LastSequence);
     }
     catch (HapticsAssetException hExcept)
     {
         Debug.LogError("[Library Manager - Haptics Asset Exception]   Exception while loading sequence - " + sequenceName + "\n\t" + hExcept.Message);
     }
     catch (System.Exception e)
     {
         Debug.LogError("[Exception]   \n\tLoad failed and set was disallowed\n" + e.Message);
     }
     LastSequenceName  = visibleName;
     greenBoxText.text = visibleName;
 }
예제 #12
0
 protected virtual void Start()
 {
     SetBeeVisual();
     sting.LoadFromAsset("Haptics/pain_short");
 }
예제 #13
0
// Use this for initialization
    void Start()
    {
        BatHaptic.LoadFromAsset("Haptic/buzz");
        HandPicker.SetActive(true);
    }
예제 #14
0
 void Start()
 {
     jolt.LoadFromAsset("Haptics/heartbeat");
 }
예제 #15
0
 // Use this for initialization
 void Start()
 {
     rumbl.LoadFromAsset("Haptic/buzz");
     buzz.LoadFromAsset("Haptic/fuzz");
 }
 void Start()
 {
     suit = HardlightSuit.Find();
     mySequence.LoadFromAsset(sequenceFileName);
 }