Exemplo n.º 1
0
 protected override void Awake()
 {
     base.Awake();
     DoorAnimator    = GetComponent <Animator>();
     UnlockSwitch    = null;
     doorAudioSource = TransformCached.GetComponentInChildren <GvrAudioSource>();
 }
Exemplo n.º 2
0
 void Start()
 {
     leftSounds  = transform.Find("LeftSounds").GetComponent <GvrAudioSource>();
     rightSounds = transform.Find("RightSounds").GetComponent <GvrAudioSource>();
     FindGlass();
     LightsOn = false;
 }
Exemplo n.º 3
0
    private void PlaySound()
    {
        Dictionary <GameObject, bool> tempChangedSoundBoxDic = new Dictionary <GameObject, bool>();

        foreach (KeyValuePair <GameObject, bool> keyValuePair in mExistSoundBoxDic)
        {
            if (!keyValuePair.Value)
            {
                GameObject     soundBoxGO  = keyValuePair.Key;
                GvrAudioSource audioSource = soundBoxGO.GetComponent <GvrAudioSource>();
                if (audioSource.isPlaying)
                {
                    tempChangedSoundBoxDic.Add(soundBoxGO, true);
                }
                else
                {
                    audioSource.clip.LoadAudioData();
                    audioSource.Play();
                    mLogger.CategoryLog(LogCategoryMethodTrace, "playing: " + audioSource.isPlaying);
                    tempChangedSoundBoxDic.Add(soundBoxGO, audioSource.isPlaying);
                }
            }
        }

        foreach (KeyValuePair <GameObject, bool> keyValuePair in tempChangedSoundBoxDic)
        {
            if (keyValuePair.Value)
            {
                mExistSoundBoxDic[keyValuePair.Key] = true;
            }
        }
    }
Exemplo n.º 4
0
 private void Start()
 {
     m_AudioSource = GetComponent <GvrAudioSource>();
     SetAnimDurations();
     CreateBuddyCommandsList(SpeechInfoState.SpeechInfoState_0);
     Subscribe();
 }
Exemplo n.º 5
0
    /// <summary>
    /// Initialization of the movie surface
    /// </summary>
    void Awake()
    {
        Debug.Log("MovieSample Awake");

#if UNITY_ANDROID && !UNITY_EDITOR
        OVR_Media_Surface_Init();
#endif
        audioEmitter  = GetComponent <GvrAudioSource>();
        mediaRenderer = GetComponent <Renderer>();
#if !UNITY_ANDROID || UNITY_EDITOR
#endif

        if (mediaRenderer.material == null || mediaRenderer.material.mainTexture == null)
        {
            // Debug.LogError("No material for movie surface");
        }

        if (movieName != string.Empty)
        {
            StartCoroutine(RetrieveStreamingAsset(movieName));
        }
        else
        {
            Debug.LogError("No media file name provided");
        }

#if UNITY_ANDROID && !UNITY_EDITOR
        nativeTexture = Texture2D.CreateExternalTexture(textureWidth, textureHeight,
                                                        TextureFormat.RGBA32, true, false,
                                                        IntPtr.Zero);

        IssuePluginEvent(MediaSurfaceEventType.Initialize);
#endif
    }
Exemplo n.º 6
0
 public void Start()
 {
     GalleryCanvas[] canvases = FindObjectsOfType <GalleryCanvas> ();
     totalPointers = canvases.Length;
     text          = GetComponent <Text> ();
     src           = GetComponent <GvrAudioSource> ();
 }
    void OnImpact(Vector3 at)
    {
        GvrAudioSource audio = GetComponent <GvrAudioSource>();

        if (audio != null && impact_audio_clip_ != null)
        {
            audio.clip = impact_audio_clip_;
            audio.loop = false;
            audio.Play();
        }

        if (explosion_ != null)
        {
            explosion_.SetActive(true);
        }

        Collider[] hitColliders = Physics.OverlapSphere(at, 1.5f);
        int        i            = 0;

        while (i < hitColliders.Length)
        {
            GameObject obj = hitColliders[i].gameObject;
            obj.SendMessage("OnExplosion", at + Vector3.down, SendMessageOptions.DontRequireReceiver);
            i++;
        }

        timer_ = 3.0f;
        GetComponent <Renderer>().enabled = false;
    }
 void Start()
 {
     if (Source == null)
     {
         Source = GetComponent <GvrAudioSource>();
     }
 }
Exemplo n.º 9
0
    public void PlayRandom()
    {
        //if the sound list is empty, re-randomize
        if (randomizedList == null || randomizedList.Count == 0)
        {
            RandomizeClips();
        }
        //if it's still empty by now, something is wrong; return
        if (randomizedList == null || randomizedList.Count == 0)
        {
            return;
        }

        GvrAudioSource gvrSource = GetComponent <GvrAudioSource>();

        //return if no audio source
        if (gvrSource == null)
        {
            return;
        }

        //get the next clip in the list
        AudioClip clip = randomizedList[randomizedList.Count - 1];

        randomizedList.RemoveAt(randomizedList.Count - 1);

        if (gvrSource != null)
        {
            gvrSource.clip   = clip;
            gvrSource.gainDb = UnityEngine.Random.Range(gainRange.x, gainRange.y);
            gvrSource.pitch  = UnityEngine.Random.Range(pitchRange.x, pitchRange.y);
            gvrSource.Play();
        }
    }
Exemplo n.º 10
0
 // Use this for initialization
 void Start()
 {
     foreach (GameObject sound in soundSources)
     {
         sound.GetComponent <GvrAudioSource>().mute = true;
     }
     gameaudio = GetComponent <GvrAudioSource>();
 }
 void Start()
 {
     audioSource = GetComponent <GvrAudioSource>();
     rigidBody   = GetComponent <Rigidbody>();
     rigidBody.maxAngularVelocity = 0.0f;
     rigidBody.freezeRotation     = true;
     ColorUtil.Colorize(type, gameObject);
 }
Exemplo n.º 12
0
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        GvrAudioSource audioSource = animator.GetComponent <GvrAudioSource>();

        audioSource.enabled = true;
        audioSource.clip    = sound;
        audioSource.Play();
    }
Exemplo n.º 13
0
        private void playAudioClip(AudioClip clip, float gain)
        {
            GvrAudioSource source = GetComponentInParent <GvrAudioSource>();

            source.gainDb = gain;
            source.clip   = clip;
            source.Play();
        }
Exemplo n.º 14
0
    public void Start()
    {
        turretAnims = gameObject.GetComponent <Animator>();

        health = GetComponent <Health>();

        deploySound = GetComponent <GvrAudioSource>();
    }
Exemplo n.º 15
0
    void Start()
    {
        animator    = GetComponent <Animator> ();
        particle    = GetComponent <ParticleSystem> ();
        soundEffect = GetComponent <GvrAudioSource> ();

        OnStart();
    }
Exemplo n.º 16
0
 void Load()
 {
     //go = Resources.Load("prefabs/GVR") as GameObject;
     //voiceObject = GameObject.Instantiate(go);
     voiceObject = GameObject.Find("GVR");
     gold        = voiceObject.transform.FindChild("gold").gameObject;
     audioSource = voiceObject.GetComponent <GvrAudioSource>();
 }
 void Start()
 {
     audioSource        = GetComponent <GvrAudioSource>();
     startScale         = transform.localScale;
     startLocalPosition = transform.localPosition;
     ColorUtil.Colorize(type, gameObject);
     swipeMenu.GetComponent <SwipeMenu>().OnSwipeSelect += OnSwipeSelect;
 }
Exemplo n.º 18
0
 // Use this for initialization
 void Start()
 {
     gameSound = GetComponent <GvrAudioSource>();
     choice    = new bool[4];
     for (int i = 0; i < choice.Length; ++i)
     {
         choice[i] = false;
     }
 }
Exemplo n.º 19
0
    void Start()
    {
        matStalk.SetColor("_EmissionColor", Color.black);
        matLeaves.SetColor("_EmissionColor", Color.black);
        groupID = int.Parse(transform.name.Substring(transform.name.Length - 1)) - 1;

        fireFlyLeftSound  = fireFlies.transform.Find("FireFlyLeft").GetComponent <GvrAudioSource>();
        fireFlyRightSound = fireFlies.transform.Find("FireFlyRight").GetComponent <GvrAudioSource>();
    }
Exemplo n.º 20
0
    private int currAudioIndex;                 // The current index that the array is currently in.

    void Awake()
    {
        cutsceneSource = GetComponent <GvrAudioSource>();

        if (player == null)
        {
            player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerState>();
        }
    }
Exemplo n.º 21
0
 // Use this for initialization
 void Start()
 {
     anim        = GetComponent <Animation>();
     helperVoice = GetComponent <GvrAudioSource>();
     if (helperCount == 0 && !anim.isPlaying)
     {
         StartCoroutine("helperLanding");
     }
 }
Exemplo n.º 22
0
    public void RevealTreasure()
    {
        treasure                    = Instantiate(treasureItem);
        treasureAudioSource         = treasure.GetComponent <GvrAudioSource>();
        treasure.transform.parent   = transform;
        treasure.transform.rotation = Quaternion.Euler(transform.rotation.x - 90, transform.rotation.y + 90, transform.rotation.z);

        isRevealed = true;
    }
Exemplo n.º 23
0
        private GvrAudioSource createAudioSource()
        {
            GameObject     gameObject  = new GameObject("AudioSource");
            GvrAudioSource audioSource = gameObject.AddComponent <GvrAudioSource>();

            audioSource.playOnAwake = false;
            audioSource.loop        = false;
            return(audioSource);
        }
Exemplo n.º 24
0
 void Awake()
 {
     GvrAudioSource[] audioSources = GetComponents <GvrAudioSource>();
     audioSelect              = audioSources[0];
     audioHover               = audioSources[1];
     audioBack                = audioSources[2];
     menuRoot.OnItemSelected += OnItemSelected;
     menuRoot.OnItemHovered  += OnItemHovered;
     menuRoot.OnMenuOpened   += OnMenuOpened;
 }
Exemplo n.º 25
0
 void Start() {
   if (Source == null) {
     Source = GetComponent<GvrAudioSource>();
   }
 }
Exemplo n.º 26
0
 /// <summary>
 /// Unity Start message
 /// </summary>
 protected virtual void Start() {
   if (Source == null) {
     Source = GetComponent<GvrAudioSource>();
   }
 }
Exemplo n.º 27
0
 void OnEnable() {
   audio_source_ = GetComponent<GvrAudioSource>();
   NextNode = FindNearestWaypoint();
   StartCoroutine(PlayAwakeSound());
 }
Exemplo n.º 28
0
 /// Updates the audio |source| with given |id| and its properties.
 /// @note This should only be called from the main Unity thread.
 public static void UpdateAudioSource (int id, GvrAudioSource source, float currentOcclusion) {
   if (initialized) {
     SetSourceBypassRoomEffects(id, source.bypassRoomEffects);
     SetSourceDirectivity(id, source.directivityAlpha, source.directivitySharpness);
     SetSourceListenerDirectivity(id, source.listenerDirectivityAlpha,
                                  source.listenerDirectivitySharpness);
     SetSourceOcclusionIntensity(id, currentOcclusion);
   }
 }