Pause() 공개 메소드

Pauses playing the clip.

public Pause ( ) : void
리턴 void
    void Start()
    {
        audio = GetComponent<AudioSource>();
		ParentAudio = transform.parent.gameObject.GetComponent<AudioSource>();
        if (audio.isPlaying)
                audio.Pause();
    }
예제 #2
0
 public override void Start()
 {
     base.Start();
     _audio = this.GetComponent<AudioSource>();
     _baseVolume = _audio.volume;
     _audio.Pause();
 }
예제 #3
0
	// Use this for initialization
	void Start () {
	
		InvokeRepeating("CreateMyInstance", 1.0f, 1.0f);

		// Checks the value of muteSound that is set on Home Screen page via the mute sound button.
		muteSoundValueCheck = PlayerPrefs.GetString("SoundValue") ;	
		
		// Debug.Log(muteSoundValueCheck);
		
		// Fetches engine sound attached to Main Camera object
		soundObject = GameObject.Find("Camera");
		audioSource = soundObject.GetComponent<AudioSource>();
		
		// Fetches Car Dash sound attached to 'car-control-cube' object 
		soundObject2 = GameObject.Find("car-control-cube");
		audioSource2 = soundObject.GetComponent<AudioSource>();
		
		if (muteSoundValueCheck == "mute") {
			
			audioSource.Pause();
			audioSource2.Pause();
			
		}


	}
예제 #4
0
 void Start()
 {
     Player = GameObject.FindGameObjectWithTag ("Player");
     GetComponent<MeshRenderer>().enabled = false;
     Scare = false;
     audiosource = this.GetComponent<AudioSource>();
     audiosource.Pause ();
 }
예제 #5
0
    IEnumerator PauseMusic(AudioSource toPause, AudioMixerSnapshot current, float time)
    {
        yield return new WaitForSeconds(time);

        if (this.current == current)
        {
            toPause.Pause();
        }
    }
예제 #6
0
 void Start()
 {
     float distance = father.transform.localScale.x;
     float radian = Mathf.Min (distance, father.transform.localScale.z);
     transform.localScale = new Vector3 (2.0f - radian / distance, transform.localScale.y, 1.0f);
     OnUpdateVariable ();
     frictionSound = father.GetComponent<AudioSource> ();
     frictionSound.Pause ();
 }
예제 #7
0
	void Start ()
	{
		Transform father = transform.parent;
		distance = father.localScale.x;
		float radian = Mathf.Min (distance, father.localScale.z);
		transform.localScale = new Vector3 (2f - radian / distance, transform.localScale.y, 1f);
		frictionSound = father.gameObject.GetComponent<AudioSource> ();
		frictionSound.Pause ();
		beltRenders = GetComponentsInChildren<Renderer> ();
	}
예제 #8
0
 private void FadeOut(AudioSource audioSource)
 {
     if(audioSource.volume > 0f) {
         audioSource.volume -= .05f;
         //print ("offing" + audioSource.clip.name);
     }
     if (audioSource.volume == 0f) {
         audioSource.Pause ();
     }
 }
예제 #9
0
 static public int Pause(IntPtr l)
 {
     try {
         UnityEngine.AudioSource self = (UnityEngine.AudioSource)checkSelf(l);
         self.Pause();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
예제 #10
0
 void Start()
 {
     music = GetComponent<AudioSource>();
     if (PlayerPrefs.HasKey ("Music")) {
         int audio = PlayerPrefs.GetInt("Music");
         if(audio == 0){
             musicOn = false;
             music.Pause();
         }
     }
 }
예제 #11
0
    void Start()
    {
        audio = GetComponent<AudioSource>();
        if(audio == null)
        {
            Debug.Log("Hello World");
        }
        audio.Pause();

        ammoCount = 15;
    }
예제 #12
0
 static public int Pause(IntPtr l)
 {
     try{
         UnityEngine.AudioSource self = (UnityEngine.AudioSource)checkSelf(l);
         self.Pause();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
예제 #13
0
 //public AudioClip Clip;// = null;
 // Use this for initialization
 void Start()
 {
     //initiate audio source
     _audioSource = GetComponent<AudioSource>();
     float r = Random.Range(-PitchVariation, PitchVariation);
     _audioSource.pitch += r;
     //_audioSource.clip = Clip;
     //set random start
     _random = Random.Range(LowerRange/Frequency, Upperrange/Frequency);
     _random += PitchOffset;
     _audioSource.Pause();
     _clipLength = _audioSource.clip.length;
 }
예제 #14
0
    // Use this for initialization
    void Start()
    {
        // audioPause = GetComponent<AudioSource>();
           // audioPause.Pause();

          //  audioLevelOne = GetComponent<AudioSource>();
          //  audioLevelOne.Play();
        AudioSource[] audios = GetComponents<AudioSource>();
        audioPause = audios[1];
        audioLevelOne = audios[0];

        audioPause.Pause();
    }
 static int Pause(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject <UnityEngine.AudioSource>(L, 1);
         obj.Pause();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
	// Use this for initialization
	void Start () {
        music_isplaying = PlayerPrefs.GetInt(Common_data.music_pref, 1);
        sound_isplaying = PlayerPrefs.GetInt(Common_data.sound_pref, 1);

        audio = this.gameObject.GetComponent<AudioSource>();
        if (music_isplaying == 1)
        {

            audio.Play();
        }
        else {
            audio.Pause();
        }

	}
예제 #17
0
    private void CheckBatInGame()
    {
        float outOfBoundsBy = 0;
        float xSide         = 50 - halfBatLen;
        float zSide         = 130 - halfBatThick;

        if ((transform.position.x > xSide || transform.position.x < -xSide || transform.position.z < -zSide))
        {
            if (Math.Abs(transform.position.x) > xSide)
            {
                outOfBoundsBy = Math.Abs(transform.position.x) - xSide;
            }
            else if (transform.position.z < -zSide)
            {
                outOfBoundsBy = Math.Abs(transform.position.z) - zSide;
            }
        }

        if (outOfBoundsBy == 0 && wallCollideAudio.isPlaying)
        {
            wallCollideAudio.Pause();
            JoyconController.RumbleJoycon(0, 0, 0);
        }
        else if (!wallCollideAudio.isPlaying && outOfBoundsBy != 0)
        {
            wallCollideAudio.Play();
        }
        if (outOfBoundsBy != 0)
        {
            float rumbleAmp = 0;
            if (outOfBoundsBy < 10)
            {
                rumbleAmp = 0.4f;
            }
            else if (outOfBoundsBy < 30)
            {
                rumbleAmp = 0.7f;
            }
            else
            {
                rumbleAmp = 0.9f;
            }
            JoyconController.RumbleJoycon(90, 270, rumbleAmp);
            wallCollideAudio.volume = GameUtils.Scale(0, 45, 0.1f, 1, outOfBoundsBy);
        }
    }
예제 #18
0
	// Use this for initialization
	void Start () {
	Time.timeScale = 1.0f;
        manager.loadAchievements();
		isPaused = false;
		isOpen = false;

		PlayerProfile.profile.load ();

		pauseSource = GetComponent<AudioSource> ();
		pauseSource.ignoreListenerPause = true;
		pauseSource.Play ();
		pauseSource.Pause ();
		PanelControls.SetActive(false);

		MovementTip.SetActive(false);
		BasicCameraTip.SetActive(false);
		SeeControlsTip.SetActive(false);
		setPause (false);
		tutTimer = PlayerProfile.profile.timeElapsedInPark;

	}
 public void PauseSound(AudioSource sound)
 {
     sound.Pause();
 }
예제 #20
0
 // ReSharper restore UnusedMember.Local
 // ReSharper disable UnusedMember.Local
 private static void PauseHandler(AudioSource source)
 {
     source.Pause();
 }
예제 #21
0
 IEnumerator WaitAndPlayStopSound(float time, AudioSource sound, bool play)
 {
     yield return new WaitForSeconds (time);
     if (play)
     {
         sound.Play();
     }
     else
     {
         sound.Pause();
     }
 }
예제 #22
0
    /// <summary>
    /// Pausa un sonido
    /// </summary>
    /// <param name="source">AudioSource que se desea pausar</param>
    public static void Pause(AudioSource source) {

        if (source.isPlaying) {
            source.Pause();
        }

    }
    IEnumerator Fade( AudioSource toFade, AudioGroup group = null, int groupIndex = -1 )
    {
        if ( !curFading.ContainsKey( toFade ) )
            yield break;

        if ( !toFade.isPlaying && curFading[toFade] > 0 )
            toFade.Play ();

        float startVolume = group != null ? group.curVolumes[groupIndex] : toFade.volume;
        float targVolume = curFading[toFade];
        float fadeAmount = 0f;

        while ( fadeAmount < 1f )
        {
            if ( !curFading.ContainsKey( toFade ) )
                yield break;

            // if audio is refaded, restart the fade from current volume
            if ( targVolume != curFading[toFade] )
            {
                StartCoroutine ( Fade ( toFade ) );
                yield break;
            }

            float newVol = Mathf.Lerp ( startVolume, targVolume, fadeAmount );
            if ( group != null )
            {
                group.curVolumes[groupIndex] = newVol;
                newVol *= masterVol;
            }

            toFade.volume = newVol;
            fadeAmount += Time.deltaTime / fadeTime;

            yield return 0;
        }

        if ( group != null )
            group.curVolumes[groupIndex] = curFading[toFade];

        toFade.volume = curFading[toFade] * ( group != null ? masterVol : 1f );

        if ( curFading[toFade] <= 0 )
            toFade.Pause ();

        curFading.Remove ( toFade );
    }
예제 #24
0
 void Start () {
     sources = (AudioSource[])playlistObj.GetComponents(typeof(AudioSource));
     source1 = sources[0];
     source1.Pause();
     source2 = sources[1];
 }
예제 #25
0
파일: Vortex.cs 프로젝트: rllamas/Quantum
    // Use this for initialization
    void Start()
    {
        /* Since these are class variables, only do if not initialized yet. */
        if (!pastMap) {
            pastMap = GameObject.Find("Past Map").GetComponent<tk2dTileMap>();
            futureMap = GameObject.Find("Future Map").GetComponent<tk2dTileMap>();

            /* Set the time period. */
            if (LevelManager.IsPast()) {
                    futureMap.gameObject.SetActive(false);
            }
            else {
                pastMap.gameObject.SetActive(false);
            }
        }

        vortexActiveParticles.transform.position = this.transform.position;
        vortexInactiveParticles.transform.position = this.transform.position;

        vortexActiveParticles.Play();
        vortexActiveParticles.startSize = 0.0f;
        vortexInactiveParticles.Play();

        sfxPlayer01 = this.transform.FindChild("SFX Player 01").GetComponent<AudioSource>();
        sfxPlayer02 = this.transform.FindChild("SFX Player 02").GetComponent<AudioSource>();

        sfxPlayer01.clip = whenNearbySound;
        sfxPlayer01.loop = true;
        sfxPlayer01.volume = 0.0f;
        sfxPlayer01.Play();

        sfxPlayer02.clip = warpSound;
        sfxPlayer02.Pause();

        glow = this.transform.FindChild("Point light").GetComponent<Light>();

        pastMap.transform.position = Vector3.zero;
        futureMap.transform.position = Vector3.zero;

        animationCurtain =  this.transform.FindChild("Curtain").GetComponent<MeshFilter>();
        mainCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<tk2dCamera>();

        animationCurtain.gameObject.SetActive(true);
        animationCurtain.renderer.material.color = new Color(0.0f, 0.0f, 0.0f, 0.0f);

        /* Since this is a class variable, only do if not initialized yet. */
        if (!player) {
            player = GameObject.FindGameObjectWithTag("Player").GetComponent<Player>();
        }

        /* Since this is a class variable, only do if not initialized yet. */
        if (pickups == null) {
            /* Get all pickups from the scene and put variable pickups. */
            GameObject [] pickupGameObjects = GameObject.FindGameObjectsWithTag("Pickup");

            pickups = new List<Pickup>();
            for (int i = 0; i < pickupGameObjects.Length; ++i) {
                pickups.Add( pickupGameObjects[i].GetComponent<Pickup>() );
            }
        }

        currentlyWarping = false;
    }
예제 #26
0
 public void pauseAudio(AudioSource audio, bool pause)
 {
     if (audio != null) {
         if (pause) {
             audio.Pause();
         } else {
             audio.Pause();
         }
     }
 }
    public void playMusic(AudioClip musicClip, float volume)
    {
        if ( muteMusic )
        {
            currentMusicAudioSource = musicAudioSourceA;
            currentMusicAudioSource.clip = musicClip;
            currentMusicAudioSource.volume = volume;
            currentMusicAudioSource.Play();
            currentMusicAudioSource.Pause();
            return;
        }

        //we have music playing already
        if( currentMusicAudioSource.isPlaying)
        {
            debugMusic("music is aleady playing, checking options");

            //check if we are in the middle of fadingIn or Out
            if(musicFadeOutTweener.IsTweening(musicFadeOutTweener.target) || musicFadeInTweener.IsTweening(musicFadeInTweener.target))
            {
                debugMusic("A Fade is happening...");

                //at this point we only care if one of the musics that was fading is the one we want
                //and we want to play it at its current volume back up to 1, the other music we fade out
                //unless neither of them are the one we want, then do a crossfade

                AudioSource fadeOutTarget = null;
                AudioSource fadeInTarget = null;

                if(musicFadeInTweener.target != null && ((AudioSource)musicFadeInTweener.target).clip.name == musicClip.name)
                {
                    fadeInTarget = (AudioSource)musicFadeInTweener.target;

                    if(musicFadeOutTweener.target != null)
                    {
                        fadeOutTarget = (AudioSource)musicFadeOutTweener.target;
                    }
                }

                if(fadeInTarget == null && musicFadeOutTweener.target != null && ((AudioSource)musicFadeOutTweener.target).clip.name == musicClip.name)
                {
                    fadeInTarget = (AudioSource)musicFadeOutTweener.target;

                    if(musicFadeInTweener.target != null)
                    {
                        fadeOutTarget = (AudioSource)musicFadeOutTweener.target;
                    }
                }

                //clean up faders
                musicFadeInTweener.Kill();
                musicFadeOutTweener.Kill();

                if(fadeOutTarget != null)
                {
                    debugMusic("Fading out:" + fadeOutTarget.clip.name);
                    fadeOutMusic(fadeOutTarget);
                }

                if(fadeInTarget != null)
                {
                    debugMusic("Fading in:" + fadeInTarget.clip.name);
                    doMusicPlay(musicClip, fadeInTarget.volume, volume);
                }

                //make sure the audioSources match up
                if(fadeOutTarget == null)
                {
                    if(fadeInTarget != null)
                    {
                        AudioSource otherSource = (fadeInTarget == musicAudioSourceA) ? musicAudioSourceB : musicAudioSourceA;
                        if(otherSource.clip != null)
                        {
                            debugMusic("Stopping music :" + otherSource.clip.name);
                            otherSource.Stop();
                        }
                    }
                }

                //we want a new clip to play if neither of the fades where for this clip
                if(fadeInTarget == null)
                {
                    doMusicCrossFade(musicClip, volume);
                }
            }
            //check if its the same clip that is already playing
            else if(currentMusicAudioSource.clip.name == musicClip.name)
            {
                debugMusic("The same music is playing already, so we will ignore play.");
                return; //this could be some other behavior like restarting it or something
            }
            //another music is playing, crossfade from one music to another
            else
            {
                debugMusic("Another music is playing, we will do a standard crossfade.");
                doMusicCrossFade(musicClip, volume);
            }
        }
        //nothing was playing fade in new music
        else if ( !muteMusic)
        {
            debugMusic("no music was playing, playing: " + musicClip.name);
            doMusicPlay(musicClip, volume);
        }
    }
예제 #28
0
 public void StopPlaying(AudioSource audio)
 {
     audio.Pause();
 }
예제 #29
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }
        if (colorReader != null)
        {
            using (var frame = colorReader.AcquireLatestFrame())
            {
                if (frame != null)
                {
                    frame.CopyConvertedFrameDataToArray(pixels, ColorImageFormat.Rgba);
                    texture.LoadRawTextureData(pixels);
                    texture.Apply();
                }
            }
        }
        //HD face frame, update points and allignement
        if (bodyReader != null)
        {
            using (var frame = bodyReader.AcquireLatestFrame())
            {
                if (frame != null)
                {
                    frame.GetAndRefreshBodyData(bodies);
                    Body body = GetActiveBody();


                    if (body != null)
                    {
                        textboxUp.text = stringTransformation + System.Environment.NewLine + System.Environment.NewLine + stringPowerLevel + System.Environment.NewLine
                                         + System.Environment.NewLine + stringKamehameha;
                        textboxDown.text = stringIndication;


                        // Detect the hand (left or right) that is closest to the sensor.
                        var handRight  = body.Joints[JointType.HandRight].Position;
                        var handLeft   = body.Joints[JointType.HandLeft].Position;
                        var elbowLeft  = body.Joints[JointType.ElbowLeft].Position;
                        var elbowRight = body.Joints[JointType.ElbowRight].Position;
                        var hipLeft    = body.Joints[JointType.HipLeft].Position;
                        var hipRight   = body.Joints[JointType.HipRight].Position;
                        var spineBase  = body.Joints[JointType.SpineBase].Position;
                        var spineMid   = body.Joints[JointType.SpineMid].Position;
                        var head       = body.Joints[JointType.Head].Position;


                        var closer = handRight.Z < handLeft.Z ? handRight : handLeft;


                        // Map the 2D position to the Unity space.
                        var worldRight      = map3dPointTo2d(handRight);
                        var worldLeft       = map3dPointTo2d(handLeft);
                        var worldElbowRight = map3dPointTo2d(elbowRight);
                        var worldElbowLeft  = map3dPointTo2d(elbowLeft);
                        var worldLeftHip    = map3dPointTo2d(hipLeft);
                        var worldRightHip   = map3dPointTo2d(hipRight);
                        var worldFrontHead  = map3dPointTo2d(head);
                        var worldCloser     = map3dPointTo2d(closer);
                        var worldSpineBase  = map3dPointTo2d(spineBase);
                        var worldSpineMid   = map3dPointTo2d(spineMid);


                        var midHand             = (worldRight + worldLeft) / 2;
                        var center              = quad.GetComponent <Renderer>().bounds.center;
                        var currentBallPosition = midHand;


                        ellapsedTime = Time.time - startTime;
                        if (timeChecker && ellapsedTime > 5.18f)
                        {
                            Renderer rend = videoTransformation.GetComponent <Renderer>();
                            rend.enabled = false;
                        }

                        if (timeChecker && ellapsedTime > 5.2f)
                        {
                            Renderer rend = videoTransformation.GetComponent <Renderer>();
                            if (transformCounter == 0)
                            {
                                vpYellow.Stop();
                                vpYellowLoop.Play();
                                rend.enabled = true;
                                powerUp1.Play();
                                stringTransformation = "Super Saiyan";
                                saiyanChargeSound.Play();
                            }
                            else if (transformCounter == 1)
                            {
                                vpDeepYellow.Stop();
                                vpDeepYellowLoop.Play();
                                rend.enabled = true;
                                powerUp2.Play();
                                stringTransformation = "Super Saiyan 2";
                                saiyanChargeSound2.Play();
                            }
                            else if (transformCounter == 2)
                            {
                                vpBlue.Stop();
                                vpBlueLoop.Play();
                                rend.enabled = true;
                                powerUp3.Play();
                                stringTransformation = "Super Saiyan God";
                                saiyanChargeSound3.Play();
                            }

                            timeChecker = false;
                        }

                        //Charge Energie if hands are close to each other and below middle of body
                        float distanceShoulders = Mathf.Abs(worldElbowRight.x - worldElbowLeft.x);
                        float distanceHands     = Mathf.Abs(worldRight.x - worldLeft.x);
                        float ratioHandShoulder = distanceHands / distanceShoulders;
                        if ((worldRight.x < worldLeftHip.x && worldLeft.x < worldLeftHip.x ||
                             worldRight.x > worldRightHip.x && worldLeft.x > worldRightHip.x) &&
                            !inAnimationKameha && powerLevel >= 400 && ratioHandShoulder < 0.75f)
                        {
                            if (loadingSide == 0 && worldRight.x < worldLeftHip.x && worldLeft.x < worldLeftHip.x)
                            {
                                loadingSide = 1;
                            }
                            else if (loadingSide == 0 && worldRight.x > worldRightHip.x && worldLeft.x > worldRightHip.x)
                            {
                                loadingSide = 2;
                            }
                            else if (loadingSide == 1 && worldRight.x < worldLeftHip.x && worldLeft.x < worldLeftHip.x ||
                                     loadingSide == 2 && worldRight.x > worldRightHip.x && worldLeft.x > worldRightHip.x)
                            {
                                kamehameha += 1;
                                if (!alreadyPlayingKameha)
                                {
                                    kamehaCharge.Play();
                                    alreadyPlayingKameha = true;
                                }
                                kamehaCharge.UnPause();
                                stringKamehameha = "Kamehameha: " + kamehameha;
                            }
                            else if (loadingSide == 2 && worldRight.x < worldLeftHip.x && worldLeft.x < worldLeftHip.x ||
                                     loadingSide == 1 && worldRight.x > worldRightHip.x && worldLeft.x > worldRightHip.x)
                            {
                                loadingSide          = 0;
                                inAnimationKameha    = true;
                                alreadyPlayingKameha = false;
                                startTime            = Time.time;
                                kamehaCharge.Stop();
                                kamehaShot.Play();
                                vpKamehameha.Play();
                            }
                            chargeKamehameha = true;
                        }
                        else
                        {
                            chargeKamehameha = false;
                            kamehaCharge.Pause();
                        }

                        if (inAnimationKameha && Time.time - startTime > 0.4f && !kamehaBuffer)
                        {
                            Renderer render = videoKamehameha.GetComponent <Renderer>();
                            render.enabled = true;

                            if (kamehameha == 0)
                            {
                                kamehameha = 0;
                                vpKamehameha.Stop();
                                kamehaShot.Stop();
                                kamehaBuffer   = true;
                                kamehaBreak    = Time.time;
                                render.enabled = false;
                            }
                            else
                            {
                                kamehameha--;
                                stringKamehameha = "Kamehameha: " + kamehameha;
                            }
                        }

                        if (kamehaBuffer && Time.time - kamehaBreak > 3f)
                        {
                            kamehaBuffer      = false;
                            inAnimationKameha = false;
                        }

                        if (ratioHandShoulder < 0.6 && !timeChecker)
                        {
                            if (powerLevel < 400)
                            {
                                if (!alreadyPlaying)
                                {
                                    alreadyPlaying = true;
                                    chargeSound.Play();
                                }
                                if (!timeChecker)
                                {
                                    chargeSound.UnPause();
                                }
                                powerLevel++;
                                if (powerLevel == 400)
                                {
                                    stringIndication = "Indication:" + System.Environment.NewLine + System.Environment.NewLine
                                                       + "Tiens tes mains à une coté de ton corps pour charger le 'Kaméhaméha'" + System.Environment.NewLine + System.Environment.NewLine
                                                       + "Amène-les à l'autre côté pour l'activer";
                                }
                                stringPowerLevel = "Power Level: " + powerLevel;
                                if (powerLevel % 100 == 0 && powerLevel < 400)
                                {
                                    Renderer rend = videoTransformation.GetComponent <Renderer>();
                                    if (powerLevel == 100)
                                    {
                                        chargeSound.Stop();
                                        vpYellow.Play();
                                        rend.enabled = true;
                                    }
                                    else if (powerLevel == 200)
                                    {
                                        saiyanChargeSound.Stop();
                                        vpDeepYellow.Play();
                                        rend.enabled = true;
                                        transformCounter++;
                                    }
                                    else if (powerLevel == 300)
                                    {
                                        saiyanChargeSound2.Stop();
                                        vpBlue.Play();
                                        rend.enabled = true;
                                        transformCounter++;
                                    }

                                    transformSound.Play();
                                    startTime   = Time.time;
                                    timeChecker = true;
                                }
                            }
                            //hands close and kamehameha position
                            else
                            {
                                if (chargeKamehameha && !inAnimationKameha)
                                {
                                    vpBlueLoop.Stop();
                                    saiyanChargeSound3.Pause();
                                }
                            }
                        }

                        videoTransformation.transform.position = new Vector3(worldFrontHead.x, -worldSpineMid.y, 0);

                        //kamehameha
                        if (inAnimationKameha)
                        {
                            //right
                            double xDiffRight     = worldRight.x - worldElbowRight.x;
                            double yDiffRight     = worldRight.y - worldElbowRight.y;
                            float  angleRadRight  = (float)Math.Atan2(yDiffRight, xDiffRight);
                            float  angleDegRight  = (float)(Math.Atan2(yDiffRight, xDiffRight) / Math.PI * 180);
                            float  widthKamehamha = 12;

                            //left
                            double xDiffLeft    = worldLeft.x - worldElbowLeft.x;
                            double yDiffLeft    = worldLeft.y - worldElbowLeft.y;
                            float  angleRadLeft = (float)Math.Atan2(yDiffLeft, xDiffLeft);
                            float  angleDegLeft = (float)(Math.Atan2(yDiffLeft, xDiffLeft) / Math.PI * 180);

                            if (angleDegLeft < 0)
                            {
                                angleDegLeft += 360;
                            }
                            if (angleDegRight < 0)
                            {
                                angleDegRight += 360;
                            }

                            float angleDeg = (angleDegLeft + angleDegRight) / 2;
                            if (Math.Abs(angleDegLeft - angleDegRight) > 180)
                            {
                                angleDeg -= 180;
                            }
                            float angleRad = (float)(angleDeg * Math.PI / 180);

                            float xMovement = (float)(Math.Cos(-angleRad) * widthKamehamha / 2);
                            float yMovement = (float)(Math.Sin(-angleRad) * widthKamehamha / 2);
                            videoKamehameha.transform.rotation   = Quaternion.Euler(0, 0, -angleDeg + 180);
                            videoKamehameha.transform.position   = new Vector3(midHand.x + xMovement, -midHand.y + yMovement, 0);
                            videoKamehameha.transform.localScale = new Vector3(widthKamehamha, 4.5f, 1);
                        }
                    }
                }
            }
        }
    }
예제 #30
0
 public static void PauseSound(AudioSource source, bool isPause)
 {
     if (isPause)
         source.Pause();
     else
         source.Play();
 }
예제 #31
0
	//sound cross fade
	IEnumerator CrossFade( AudioSource a1,  AudioSource a2, float duration){
		float v0  = a1.volume; // keep the original volume
		a2.Play(); // make sure a2 is playing
		float t  = 0;
		while (t < 1){

			t = Mathf.Clamp01(t + Time.deltaTime / duration);
			a1.volume = (1 - t) * v0;
			a2.volume = t * v0;
			yield return new WaitForSeconds(0.01f);
		}
		a1.Pause();
	}
예제 #32
0
 void Start()
 {
     windSound = GetComponent<AudioSource> ();
     windSound.Pause ();
 }