UnPause() public method

Unpause the paused playback of this AudioSource.

public UnPause ( ) : void
return void
コード例 #1
0
 static public int UnPause(IntPtr l)
 {
     try {
         UnityEngine.AudioSource self = (UnityEngine.AudioSource)checkSelf(l);
         self.UnPause();
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #2
0
 static public int UnPause(IntPtr l)
 {
     try {
         UnityEngine.AudioSource self = (UnityEngine.AudioSource)checkSelf(l);
         self.UnPause();
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
コード例 #3
0
 static int UnPause(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         UnityEngine.AudioSource obj = (UnityEngine.AudioSource)ToLua.CheckObject <UnityEngine.AudioSource>(L, 1);
         obj.UnPause();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #4
0
    // Update is called once per frame


    public override void mytimer()
    {
        handposition = hand.transform.localPosition;
        if (hoverbutton.buttom_name == "null" || hoverbutton.buttom_name == gameObject.name)
        {
            if (isHandOver())
            {
                timecount = timestart - (int)Time.time;
                if (hand_animator.isActiveAndEnabled)
                {
                    hand_animator.Play("Base Layer.hand");
                }
                if (music_name.text != musicname.text)
                {
                    buttonimgwhenhover();
                    //button_image.sprite = button_image_hover;// Resources.Load ("04/04_music_hover", typeof(Sprite)) as Sprite;
                    //musicname.color = Color.black;
                }
                hoverbutton.buttom_name = gameObject.name;
                //music_init ();
                bgaudio.Pause();
                if (!tmpaudio.isPlaying)
                {
                    tmpaudio.Play();
                }
                tmpaudio.UnPause();
                if (timecount == 0)
                {
                    decide_music();
                    timestart = 0;
                    timecount = timelong;
                }
            }
            else
            {
                if (music_name.text != musicname.text)
                {
                    buttonimgwhenoff();
                }

                hand_animator.Play("Base Layer.none");
                hoverbutton.buttom_name = "null";
                tmpaudio.Stop();
                bgaudio.UnPause();
                timestart = (int)Time.time + timelong;
            }
        }
    }
コード例 #5
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);
                        }
                    }
                }
            }
        }
    }
コード例 #6
0
ファイル: AudioManager.cs プロジェクト: ForsakenGS/LostKids
    /// <summary>
    /// Reanuda un sonido
    /// </summary>
    /// <param name="source">AudioSource que se desea reanudar</param>
    public static void Resume(AudioSource source) {

        if (!source.isPlaying) {
            source.UnPause();
        }
        
    }