Ejemplo n.º 1
0
        /* Functions */

        private void Awake()
        {
            mSoundPlayer = this.GetComponent <JCS_SoundPlayer>();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Take a snapshot and store image to data path.
        /// </summary>
        public string TakeSnapshotWebcam()
        {
            // No device detected!!
            // cannot take snap shot without the device!!
            if (!mDetectDevice)
            {
                JCS_Debug.LogError("No webcam detected in the current devices");
                return(null);
            }

            var gs     = JCS_GameSettings.instance;
            var prefix = gs.WEBCAM_FILENAME;
            var ext    = gs.WEBCAM_EXTENSION;

            string savePath = SavePath();

            JCS_IO.CreateDirectory(savePath);

            Texture2D snap = new Texture2D(mWebCamTexture.width, mWebCamTexture.height);

            snap.SetPixels(mWebCamTexture.GetPixels());
            snap.Apply();

            // get the last saved webcam image's index
            int last_saved_index = LastImageFileIndex() + 1;

            string fullPath = ImagePathByIndex(last_saved_index);

            File.WriteAllBytes(fullPath, snap.EncodeToPNG());


            if (mSplash)
            {
                JCS_SceneManager sm = JCS_SceneManager.instance;

                if (sm.GetWhiteScreen() == null)
                {
                    JCS_UtilityFunctions.PopJCSWhiteScreen();
                }

                sm.GetWhiteScreen().FadeIn();

                // do the snap shot effect
                mSplashEffectTrigger = true;
            }

            // Stop the camera
            mWebCamTexture.Pause();

            // start the timer wait for resume
            mResumeTrigger = true;

            // play sound.
            {
                var             soundm = JCS_SoundManager.instance;
                JCS_SoundPlayer sp     = soundm.GetGlobalSoundPlayer();
                sp.PlayOneShot(mTakePhotoSound);
            }

            return(fullPath);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Play switch scene sound.
        /// </summary>
        private void PlaySwitchSceneSound()
        {
            JCS_SoundPlayer sp = JCS_SoundManager.instance.GetGlobalSoundPlayer();

            sp.PlayOneShot(this.mSwitchSceneSound);
        }
Ejemplo n.º 4
0
        /* Functions */

        protected virtual void Awake()
        {
            mSoundPlayer   = this.GetComponent <JCS_SoundPlayer>();
            mAudioListener = this.GetComponent <AudioListener>();
        }
        /*******************************************/
        /*            Unity's function             */
        /*******************************************/
        protected override void Awake()
        {
            base.Awake();

            this.mSoundPlayer = this.GetComponent <JCS_SoundPlayer>();
        }
 /// <summary>
 /// Play the button click sound.
 /// </summary>
 private void PlayButtonClickSound()
 {
     JCS_SoundPlayer.PlayByAttachment(mSoundPlayer, mButtonClickSound, mSoundMethod);
 }
Ejemplo n.º 7
0
 //========================================
 //      Unity's function
 //------------------------------
 private void Awake()
 {
     mTransformTweener = this.GetComponent <JCS_TransformTweener>();
     mSoundPlayer      = this.GetComponent <JCS_SoundPlayer>();
 }