SetRTPCValue() public static method

public static SetRTPCValue ( string in_pszRtpcName, float in_value ) : AKRESULT
in_pszRtpcName string
in_value float
return AKRESULT
Ejemplo n.º 1
0
    void FixedUpdate()
    {
        float translation = Input.GetAxisRaw("Horizontal");

        if ((ButtonsClass.getActualButton() == 1) && (Time.time > nextTime))
        {
            if (manager.GetKey(GameManager.e_input.RIGHT, 0.8f) && ((value + 10) <= 100))
            {
                value += 10;
                setUpSound(value);
            }
            else if (manager.GetKey(GameManager.e_input.LEFT, -0.8f) && ((value - 10) >= 0))
            {
                value -= 10;
                setUpSound(value);
            }
            else
            {
                return;
            }

            if (MusicManager.WebGLBuildSupport)
            {
                MusicManager.SetMainVolume(value);
            }
            else
            {
                #if !UNITY_WEBGL
                AkSoundEngine.SetRTPCValue("Music_Volume", value, music);
                #endif
            }

            music.GetComponent <MusicPlayer>().Main_Volume = value;
            nextTime = Time.time + 0.1f;
        }
    }
Ejemplo n.º 2
0
 public void SetMasterVolume(float volume)
 {
     AkSoundEngine.SetRTPCValue("MasterVolume", volume);
 }
Ejemplo n.º 3
0
    void Update()
    {
        gravity = -(2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2);                     //Gravity defined based of jumpheigmaxJumpVelocityto reach highest point

        maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;                             //Max jump velocity defined based on gravity and time to reach highest point
        minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight);              //Min jump velocity defined based on gravity and min jump height

        input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); //Input from player

        if (inverseControlX)
        {
            if (input.x > 0 || input.y > 0)
            {
                input.x = -input.x;
                input.y = -input.y;
            }
            else if (input.x < 0 || input.y < 0)
            {
                input.x = Mathf.Abs(input.x);
                input.y = Mathf.Abs(input.y);
            }
        }
        wallDirX = (controller.collisions.left)? -1:1;                                                                                          //wall direction left or right

        targetVelocityX = (controller.playerOnLeftWall || controller.playerOnRightWall)?input.y * moveSpeed:input.x * moveSpeed;


        if (input.x == 1 || input.x == -1)         //[BUG REPORT] Minor problem with changing direction and keeping same speed
        {
            accelerationTimeGrounded = 0.25f;
        }
        else
        {
            accelerationTimeGrounded = 0.05f;             //0.05
        }

        velocity.x = Mathf.SmoothDamp(velocity.x, targetVelocityX, ref velocityXSmoothing, (controller.collisions.below)?accelerationTimeGrounded:accelerationTimeAirborn); //Calculating velocity x both airborn and on ground with smoothing

        animator.SetFloat("speed", Mathf.Abs(velocity.x));                                                                                                                  //ANIMATION
        animator.SetBool("ground", controller.collisions.below);                                                                                                            //ANIMATION
        animator.SetBool("transforming", intoLine.transforming);
        animator.SetFloat("vSpeed", velocity.y);                                                                                                                            //ANIMATION

        if (!controller.collisions.below)
        {
            timeSinceJump += Time.deltaTime;
        }
        else
        {
            timeSinceJump = 0f;
        }

        if (Input.GetButtonDown("Jump"))
        {
            if (controller.collisions.below)
            {
                animator.SetBool("jumping", true);
                Jump();
            }
        }

        if (!controller.collisions.below)
        {
            landed    = false;
            moveSpeed = airSpeed;
        }
        else if (controller.collisions.below && landed == false)
        {
            moveSpeed = groundSpeed;
            landed    = true;
            animator.SetBool("landed", true);
            spriteMask.enabled = true;
            boxCol.size        = startColSize;
        }
        if (Mathf.Sign(velocity.y) == -1)
        {
            timeToJumpApex = gravityModifierFall;             //55 //0.75
            jumpParticles.Stop();
        }
        else
        {
            timeToJumpApex = gravityModifierJump;            //0.92f;	//72
        }

        if (Input.GetButtonUp("Jump"))                                          //For variable jump
        {
            if (velocity.y > minJumpVelocity)
            {
                velocity.y = minJumpVelocity;                                   //When space is released set velocity y to minimum jump velocity
                AkSoundEngine.SetRTPCValue("Pitch", 2);                         //Sound
            }
        }
        if (movementUnlocked == true)
        {
            velocity.y += gravity * Time.deltaTime;
        }
        controller.Move((movementUnlocked)?velocity * Time.deltaTime:new Vector3(0, 0, 0), (movementUnlocked)?input:new Vector2(0, 0));     //Moving character && Checking if Movement is unlocked. If it is add small downward velocity and freeze input.


        if (controller.collisions.above || controller.collisions.below)                         //If raycasts hit above or below, velocity on y axis stops
        {
            velocity.y = 0;
        }
    }
Ejemplo n.º 4
0
 public void SetMasterVol(float vol)
 {
     AkSoundEngine.SetRTPCValue("MasterVol", vol);
 }
Ejemplo n.º 5
0
    /// <summary>
    /// Posts a Wwise event using the gameobject supplied if the sound is not occluded.
    /// Set any RTPC values before calling this method.
    /// </summary>
    /// <param name="postingObject">The gameobject that wishes to post an event.</param>
    /// <param name="postingEvent">The event which you wish to post.</param>
    /// <param name="attenuationRTPCName">The name of the object's attenuation RTPC.</param>
    public void PostEventAndAddLocation(GameObject postingObject, AK.Wwise.Event postingEvent, string attenuationRTPCName)
    {
        //If the object posting the event is the listener then no raycasting or attenuation is needed.
        if (postingObject.name == listenerName)
        {
            postingEvent.Post(postingObject);
            PlayFootstep();
            return;
        }

        float distance = Vector3.Distance(postingObject.transform.position, listenerTransform.position);

        if (distance > maxAttenuationRange)
        {
            return;
        }

        RaycastHit hit;
        Vector3    direction         = listenerTransform.position - postingObject.transform.position;
        Vector3    startPosition     = postingObject.transform.position;
        bool       playerHit         = false;
        float      occlusionModifier = 1.0f;
        bool       nothingHit        = false;
        float      rangeModifier     = 0;

        while (!playerHit && !(occlusionModifier <= 0.0f) && !nothingHit)
        {
            if (Physics.Raycast(startPosition, direction, out hit, maxAttenuationRange - rangeModifier))
            {
                if (hit.collider.gameObject.name == listenerName)
                {
                    playerHit = true;
                    if (attenuationRTPCName != "")
                    {
                        AkSoundEngine.SetRTPCValue(attenuationRTPCName, distance, postingObject);
                    }

                    if (postingObject.name != "Radio")
                    {
                        postingEvent.Post(postingObject);
                    }

                    //The amount to modify the sound radius by.
                    float attenuationModifier = 1.0f;
                    //The percentage of sound being attenuated
                    float attenuationPercentage = ((distance / maxAttenuationRange));

                    attenuationModifier -= attenuationPercentage;
                    if (occlusionModifier < 0)
                    {
                        occlusionModifier = 0;
                    }

                    AkSoundEngine.SetRTPCValue("Occlusion_RTPC", occlusionModifier * 100.0f, postingObject);
                    switch (postingObject.name)
                    {
                    case "Pickup":
                        AddBrickSound(postingObject.transform.position, attenuationModifier, occlusionModifier);
                        break;

                    case "Enemy":
                        PlayEnemySound(postingObject.transform.position, attenuationModifier, occlusionModifier);
                        break;

                    case "Radio":
                        RadioPlayer radioPlayer;
                        if (postingObject.TryGetComponent(out radioPlayer))
                        {
                            radioPlayer.ActivateSound(attenuationModifier, occlusionModifier);
                        }
                        break;

                    case "Gate":
                        AddMiscLocation(postingObject.transform.position, attenuationModifier, occlusionModifier, "Gate");
                        break;

                    default:
                        AddMiscLocation(postingObject.transform.position, attenuationModifier, occlusionModifier, "Unknown");
                        break;
                    }
                }
                else
                {
                    switch (hit.collider.tag)
                    {
                    case "Wood":
                        occlusionModifier -= 0.1f;
                        break;

                    case "Metal":
                        occlusionModifier -= 0.2f;
                        break;

                    case "Stone":
                        occlusionModifier -= 0.8f;
                        break;

                    default:
                        occlusionModifier -= 0.1f;
                        break;
                    }
                    rangeModifier += Vector3.Magnitude(startPosition - hit.point);
                    startPosition  = hit.point;
                    direction      = listenerTransform.position - startPosition;
                    startPosition += direction * 0.01f;
                }
            }
            else
            {
                nothingHit = true;
            }
        }
    }
Ejemplo n.º 6
0
 public void UpdateSFXVolume(float newPercent)
 {
     Game.current.Progress.SetValue("SFXVolume", newPercent);
     AkSoundEngine.SetRTPCValue("Effects_Slider", newPercent * 100);
 }
Ejemplo n.º 7
0
 public void UpdateMasterVolume(float newPercent)
 {
     Game.current.Progress.SetValue("MasterVolume", newPercent);
     AkSoundEngine.SetRTPCValue("Master_Slider", newPercent * 100);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// NOT SURE MUST ASK!!!!!
 /// </summary>
 public void SetRTPCValue(string rTpcName, float value)
 {
     AkSoundEngine.SetRTPCValue(rTpcName, value);
 }
Ejemplo n.º 9
0
 public void UpdateSFXVolume(float volume)
 {
     SFX = volume;
     AkSoundEngine.SetRTPCValue("SFXVolume", volume);
     PlayerPrefs.SetFloat("SFXVolume", volume);
 }
Ejemplo n.º 10
0
 public void UpdateMusicVolume(float volume)
 {
     Music = volume;
     AkSoundEngine.SetRTPCValue("MusicFader", volume);
     PlayerPrefs.SetFloat("MusicFader", volume);
 }
Ejemplo n.º 11
0
 public void UpdateAmbienceVolume(float volume)
 {
     Ambience = volume;
     AkSoundEngine.SetRTPCValue("AmbienceFader", volume);
     PlayerPrefs.SetFloat("AmbienceFader", volume);
 }
Ejemplo n.º 12
0
 public void UpdateMasterVolume(float volume)
 {
     Master = volume;
     AkSoundEngine.SetRTPCValue("MasterFader", volume);
     PlayerPrefs.SetFloat("MasterFader", volume);
 }
Ejemplo n.º 13
0
 public void SetVolume(float volume)
 {
     PlayerPrefs.SetFloat("volume", volume);
     AkSoundEngine.SetRTPCValue("volumen_musica", volume);
 }
Ejemplo n.º 14
0
 public void SetVolumeSFX(float volume)
 {
     PlayerPrefs.SetFloat("volumesfx", volume);
     AkSoundEngine.SetRTPCValue("volumen_sfx", volume);
 }
Ejemplo n.º 15
0
 public void SetSoundValue(float _value)
 {
     AkSoundEngine.SetRTPCValue("sound_level", _value);
 }
Ejemplo n.º 16
0
 private void PlayCurrentAudioRoom(AudioRoom ar)
 {
     ar.PlayEvent();
     AkSoundEngine.SetRTPCValue("position_gd_" + ar.id, 50);
     StartCoroutine(FadeInAudioRoutine(ar));
 }
Ejemplo n.º 17
0
 void DelayMainMenuMusic()
 {
     AkSoundEngine.SetRTPCValue("click_start", 100f, null, 500);
     //AkSoundEngine.PostEvent("play_intro", gameObject);
     //GameObject.Find("StartSetUp").GetComponent<StartGame>().Play("character_select");
 }
Ejemplo n.º 18
0
 public void UpdateVoicesVolume(float volume)
 {
     Voices = volume;
     AkSoundEngine.SetRTPCValue("VoicesFader", volume);
     PlayerPrefs.SetFloat("VoicesFader", volume);
 }
Ejemplo n.º 19
0
        public void Update(float dt)
        {
            Vector2 mouse = this.Mouse;

            Vector3 relativeVelocity           = this.LinearVelocity.Value - this.SupportVelocity.Value;
            Vector3 horizontalRelativeVelocity = relativeVelocity;

            horizontalRelativeVelocity.Y = 0;
            float horizontalSpeed = horizontalRelativeVelocity.Length();

            if (horizontalSpeed < this.lastHorizontalSpeed)
            {
                horizontalSpeed = Math.Max(horizontalSpeed, this.lastHorizontalSpeed - 40.0f * dt);
            }
            else if (horizontalSpeed > this.lastHorizontalSpeed)
            {
                horizontalSpeed = Math.Min(horizontalSpeed, this.lastHorizontalSpeed + 10.0f * dt);
            }
            this.lastHorizontalSpeed = horizontalSpeed;

            if (this.WallRunState == WallRun.State.None)
            {
                this.model.Stop
                (
                    "WallRunLeft",
                    "WallRunRight",
                    "WallRunStraight",
                    "WallSlideDown",
                    "WallSlideReverse"
                );

                if (this.IsSupported)
                {
                    this.model.Stop
                    (
                        "Jump",
                        "Jump02",
                        "Jump03",
                        "JumpLeft",
                        "JumpBackward",
                        "JumpRight",
                        "Fall",
                        "Swim",
                        "SwimForward"
                    );

                    Vector2 dir   = this.Movement;
                    float   angle = (float)Math.Atan2(dir.Y, dir.X);
                    if (angle < 0.0f)
                    {
                        angle += (float)Math.PI * 2.0f;
                    }

                    string movementAnimation;

                    if (this.EnableWalking)
                    {
                        if (this.Crouched)
                        {
                            if (dir.LengthSquared() == 0.0f)
                            {
                                movementAnimation = "CrouchIdle";
                            }
                            else
                            {
                                movementAnimation = AnimationController.crouchDirections[(int)Math.Round(angle / ((float)Math.PI * 0.25f)) % 8];
                            }
                        }
                        else
                        {
                            if (dir.LengthSquared() == 0.0f)
                            {
                                movementAnimation = "Idle";
                            }
                            else
                            {
                                movementAnimation = AnimationController.directions[(int)Math.Round(angle / ((float)Math.PI * 0.25f)) % 8];
                            }
                        }
                    }
                    else
                    {
                        if (this.Crouched)
                        {
                            movementAnimation = "CrouchIdle";
                        }
                        else
                        {
                            movementAnimation = "Idle";
                        }
                    }

                    foreach (KeyValuePair <string, AnimationInfo> animation in this.Crouched ? crouchMovementAnimations : movementAnimations)
                    {
                        if (animation.Key != "Idle" && animation.Key != "CrouchIdle")
                        {
                            this.model[animation.Key].Speed = Math.Min(horizontalSpeed * (this.Crouched ? animationSpeedCoefficientCrouched : animationSpeedCoefficient), maxAnimationSpeed);
                        }
                        this.model[animation.Key].TargetStrength = animation.Key == movementAnimation ? 1.0f : animation.Value.DefaultStrength;
                    }

                    bool nowIdling = false;
                    if (movementAnimation == "Run")
                    {
                        this.sprintAnimation.TargetStrength = MathHelper.Clamp((horizontalSpeed - sprintThreshold) / sprintRange, 0.0f, 1.0f);
                        this.runAnimation.TargetStrength    = Math.Min(MathHelper.Clamp(horizontalSpeed / sprintThreshold, 0.0f, 1.0f), 1.0f - this.sprintAnimation.TargetStrength);
                    }
                    else if (movementAnimation != "Idle" && movementAnimation != "CrouchIdle")
                    {
                        this.model[movementAnimation].TargetStrength = MathHelper.Clamp(this.Crouched ? horizontalSpeed / 2.0f : horizontalSpeed / sprintThreshold, 0.0f, 1.0f);
                    }
                    else if (movementAnimation == "Idle")
                    {
                        nowIdling = true;
                    }

                    if (nowIdling)
                    {
                        if (this.idling)
                        {
                            // We're already idling. Blend to new idle rotation if necessary
                            if (this.idleRotationBlend < 1.0f)
                            {
                                this.idleRotationBlend += dt / idleRotationBlendTime;
                                if (this.idleRotationBlend >= 1.0f)
                                {
                                    this.idleRotation = this.Rotation;                                     // We're done blending
                                }
                            }
                            else
                            {
                                float rotationDiff = this.Rotation - this.idleRotation.ClosestAngle(this.Rotation);
                                if (Math.Abs(rotationDiff) > Math.PI * 0.25)
                                {
                                    this.idleRotationBlend = 0.0f;                                     // Start blending to new rotation
                                    this.model.StartClip(rotationDiff > 0.0f ? "TurnLeft" : "TurnRight", 1);
                                }
                            }
                        }
                        else                                    // We just started idling.
                        {
                            if (this.idleRotationBlend >= 1.0f) // Save the current rotation.
                            {
                                this.idleRotation = this.Rotation;
                            }
                        }
                    }
                    else
                    {
                        if (this.idling)                         // We're just now coming out of idle state
                        {
                            if (this.idleRotationBlend > 1.0f)
                            {
                                this.idleRotationBlend = 0.0f;
                            }
                        }
                        if (this.idleRotationBlend < 1.0f)
                        {
                            this.idleRotationBlend += dt / idleRotationBlendTime;
                            if (this.idleRotationBlend >= 1.0f)
                            {
                                this.idleRotation = this.Rotation;                                 // We're done blending
                            }
                        }
                    }
                    this.idling = nowIdling;

                    if (!this.model.IsPlaying(movementAnimation))
                    {
                        foreach (string anim in this.Crouched ? movementAnimations.Keys : crouchMovementAnimations.Keys)
                        {
                            this.model.Stop(anim);
                        }
                        Dictionary <string, AnimationInfo> animations = this.Crouched ? crouchMovementAnimations : movementAnimations;
                        TimeSpan currentTime = TimeSpan.FromSeconds(this.random.NextDouble() * this.model[animations.Keys.First()].Duration.TotalSeconds);
                        foreach (KeyValuePair <string, AnimationInfo> animation in animations)
                        {
                            this.model.StartClip(animation.Key, animation.Value.Priority, true, AnimatedModel.DefaultBlendTime);
                            SkinnedModel.Clip clip = this.model[animation.Key];
                            clip.CurrentTime = currentTime;
                            clip.Strength    = animation.Value.DefaultStrength;
                        }
                    }
                }
                else
                {
                    this.idling = false;
                    foreach (string anim in movementAnimations.Keys)
                    {
                        this.model.Stop(anim);
                    }
                    foreach (string anim in crouchMovementAnimations.Keys)
                    {
                        this.model.Stop(anim);
                    }

                    if (this.IsSwimming)
                    {
                        this.model.Stop("Fall");
                        if (this.Movement.Value.Y > 0.25f)
                        {
                            this.model.Stop("Swim");
                            if (!this.model.IsPlaying("SwimForward"))
                            {
                                this.model.StartClip("SwimForward", 0, true, AnimatedModel.DefaultBlendTime);
                                SkinnedModel.Clip clip = this.model["SwimForward"];
                                clip.CurrentTime = TimeSpan.FromSeconds(this.random.NextDouble() * clip.Duration.TotalSeconds);
                            }
                        }
                        else
                        {
                            this.model.Stop("SwimForward");
                            if (!this.model.IsPlaying("Swim"))
                            {
                                this.model.StartClip("Swim", 0, true, AnimatedModel.DefaultBlendTime);
                                SkinnedModel.Clip clip = this.model["Swim"];
                                clip.CurrentTime = TimeSpan.FromSeconds(this.random.NextDouble() * clip.Duration.TotalSeconds);
                            }
                        }
                    }
                    else
                    {
                        this.model.Stop("SwimForward");
                        if (!this.model.IsPlaying("Fall"))
                        {
                            this.model.StartClip("Fall", 0, true, AnimatedModel.DefaultBlendTime);
                            this.fallAnimation.CurrentTime = TimeSpan.FromSeconds(random.NextDouble() * this.fallAnimation.Duration.TotalSeconds);
                        }
                    }

                    this.fallAnimation.Speed = MathHelper.Clamp(this.LinearVelocity.Value.Length() * (1.0f / 20.0f), 0, 2);
                }
            }
            else
            {
                this.idling = false;
                this.model.Stop
                (
                    "Jump",
                    "Jump02",
                    "Jump03",
                    "JumpLeft",
                    "JumpBackward",
                    "JumpRight",
                    "Fall"
                );
                foreach (string anim in movementAnimations.Keys)
                {
                    this.model.Stop(anim);
                }

                string wallRunAnimation;
                switch (this.WallRunState.Value)
                {
                case WallRun.State.Straight:
                    wallRunAnimation = "WallRunStraight";
                    break;

                case WallRun.State.Down:
                    wallRunAnimation = "WallSlideDown";
                    break;

                case WallRun.State.Left:
                    wallRunAnimation = "WallRunLeft";
                    break;

                case WallRun.State.Right:
                    wallRunAnimation = "WallRunRight";
                    break;

                default:
                    wallRunAnimation = null;
                    break;
                }
                if (!this.model.IsPlaying(wallRunAnimation))
                {
                    this.model.Stop
                    (
                        "WallRunStraight",
                        "WallSlideDown",
                        "WallRunLeft",
                        "WallRunRight",
                        "WallSlideReverse"
                    );
                    this.model.StartClip(wallRunAnimation, 1, true);
                }

                if (wallRunAnimation != null)
                {
                    Vector3 wallNormal     = this.WallRunMap.Value.GetAbsoluteVector(this.WallDirection.Value.GetVector());
                    float   animationSpeed = (relativeVelocity - wallNormal * Vector3.Dot(relativeVelocity, wallNormal)).Length();
                    this.model[wallRunAnimation].Speed = Math.Min(maxAnimationSpeedWallRun, animationSpeed * animationSpeedCoefficientWallRun);
                }
            }

            // Rotate head to match mouse
            this.relativeHeadBone.Value *= Matrix.CreateRotationX(mouse.Y * 0.6f);
            this.model.UpdateWorldTransforms();

            float l = 0.0f;

            if (this.EnableLean)
            {
                l = horizontalSpeed * (this.lastRotation.ClosestAngle(this.Rotation) - this.Rotation) * (1.0f / 60.0f) / dt;
            }
            this.lastRotation = this.Rotation;
            this.Lean.Value  += (l - this.Lean) * 20.0f * dt;

            const float timeScale = 5.0f;
            const float softBreathingThresholdPercentage = 0.75f;
            float       newBreathing;

            if (!this.Crouched && this.Movement.Value.LengthSquared() > 0.0f && horizontalSpeed > Character.DefaultMaxSpeed * 0.75f)
            {
                newBreathing = Math.Min(this.breathing + (dt / timeScale), 1.0f);
                if (this.breathing < softBreathingThresholdPercentage && newBreathing > softBreathingThresholdPercentage)
                {
                    AkSoundEngine.PostEvent(AK.EVENTS.PLAY_PLAYER_BREATHING_SOFT, this.Entity);
                    newBreathing = 1.0f;
                }
            }
            else
            {
                newBreathing = Math.Max(0, this.breathing - dt / timeScale);
                if (this.breathing > softBreathingThresholdPercentage && newBreathing < softBreathingThresholdPercentage)
                {
                    AkSoundEngine.PostEvent(AK.EVENTS.STOP_PLAYER_BREATHING_SOFT, this.Entity);
                    newBreathing = 0.0f;
                }
            }
            this.breathing = newBreathing;
            AkSoundEngine.SetRTPCValue(AK.GAME_PARAMETERS.SFX_PLAYER_SLIDE, MathHelper.Clamp(relativeVelocity.Length() / 8.0f, 0.0f, 1.0f) * (this.Kicking ? 1.0f : 0.25f));
        }
Ejemplo n.º 20
0
        private void UpdateMovement(PlayerInput input)
        {
            rb.AddRelativeForce(0, 0, input.MoveForward * moveForward);
            rb.AddRelativeForce(input.StrafeRight * strafeForce, 0, 0);
            rb.AddRelativeForce(0, input.StrafeUp * strafeForce, 0);
            rb.AddRelativeTorque(0, 0, input.RollLeft * barrelRollTorque);
            rb.AddRelativeTorque(0, input.YawDelta * yawTorque, 0);
            rb.AddRelativeTorque(input.PitchDelta * pitchTorque, 0, 0);

            if (input.MoveForward != 0)
            {
                if (!isMovingForward)
                {
                    AudioManager.instance.Play(AudioBank.SFX_SHIP_FORBACK, this.gameObject);
                }
                //AudioManager.instance.Play(AudioBank.SFX_SHIP_BACK, this.gameObject);

                isMovingForward = true;
                forwardValue   += input.MoveForward;
                forwardValue    = Mathf.Clamp(forwardValue, 1, 3);
                AkSoundEngine.SetRTPCValue("Pitch", forwardValue);
            }

            if (input.StrafeRight != 0)
            {
                if (!isMovingSideways)
                {
                    AudioManager.instance.Play(AudioBank.SFX_SHIP_SIDE, this.gameObject);
                }

                //AudioManager.instance.Play(AudioBank.SFX_SHIP_BURST, this.gameObject);
                //AudioManager.instance.Play(AudioBank.SFX_SHIP_SWAY, this.gameObject);

                isMovingSideways = true;
                sideValue       += input.StrafeRight;
                sideValue        = Mathf.Clamp(sideValue, 1, 3);
                AkSoundEngine.SetRTPCValue("Roll", sideValue);
            }

            if (input.StrafeUp != 0)
            {
                if (!isMovingUp)
                {
                    AudioManager.instance.Play(AudioBank.SFX_SHIP_UPDOWN, this.gameObject);
                }

                isMovingUp = true;
                upValue   += input.StrafeUp;
                upValue    = Mathf.Clamp(upValue, 1, 3);
                AkSoundEngine.SetRTPCValue("Yaw", upValue);
            }

            if (input.StrafeRight == 0 && input.MoveForward == 0 && input.StrafeUp == 0 && (isMovingForward || isMovingSideways || isMovingUp))
            {
                isMovingSideways = false;
                isMovingForward  = false;
                isMovingUp       = false;
                forwardValue     = 50;
                sideValue        = 50;
                upValue          = 50;
                AudioManager.instance.Play(AudioBank.SFX_SHIP_STOP, this.gameObject);
            }
        }
Ejemplo n.º 21
0
 public void UpdateMusicVolume(float newPercent)
 {
     Game.current.Progress.SetValue("BackgroundVolume", newPercent);
     AkSoundEngine.SetRTPCValue("Music_Slider", newPercent * 100);
 }
Ejemplo n.º 22
0
 public static void SetMasterVolume()
 {
     AkSoundEngine.SetRTPCValue("MainVolume", SettingsPanel.MasterVolume);
 }
Ejemplo n.º 23
0
 public void SetPlayerVelocity(float playerVelocity)
 {
     AkSoundEngine.SetRTPCValue("playerVelocity", playerVelocity);
 }
Ejemplo n.º 24
0
 public static void SetRTPC(string param, float val)
 {
     AkSoundEngine.SetRTPCValue(param, val);
 }
Ejemplo n.º 25
0
 private void Update()
 {
     // TODO send linear (0,1) elevator height to Wwise
     AkSoundEngine.SetRTPCValue("Elevator_RTPC", linearMapping.value, gameObject);
     // linearMapping.value
 }
Ejemplo n.º 26
0
 public static void SetRTPC(string param, float val, GameObject go)
 {
     AkSoundEngine.SetRTPCValue(param, val, go);
 }
Ejemplo n.º 27
0
 public void SetSFXVol(float vol)
 {
     AkSoundEngine.SetRTPCValue("SFXVol", vol);
 }
Ejemplo n.º 28
0
 // Update is called once per frame
 void Update()
 {
     AkSoundEngine.SetRTPCValue("SoulMovement", this.gameObject.GetComponent <Rigidbody>().velocity.magnitude);
 }
Ejemplo n.º 29
0
    void Update()
    {
        if (Active)
        {
            if (!m_attract)
            {
                if (m_interactHand.ObjectInTrigger)
                {
                    Target = null;
                }
                else if (!m_connectedBody)
                {
                    Target = m_interactiblesManager.GetClosestToView(transform.position, m_repere.position - transform.position, 15);
                }
            }

            if (Target)
            {
                float distanceScale = Mathf.Min(GetDistanceToTarget() / m_initDistanceToTarget, 1);                 // 1 -> 0

                // Detect movement to trigger attraction
                if (m_attract)
                {
                    Vector3 force = (m_repere.position - m_lastPos) * 10;

                    if (force.sqrMagnitude > m_maxForce)
                    {
                        force = force.normalized * m_maxForce;
                    }

                    if (force.sqrMagnitude > Mathf.Max(m_minMagnitudeToAttract, m_lastForceApplied.sqrMagnitude))
                    {
                        Attract(force);
                    }

                    // Levitation
                    if (!m_connectedBody && IsLevitating(Target))
                    {
                        Rigidbody rgbd = Target.GetComponent <Rigidbody>();
                        rgbd.velocity = Vector3.ClampMagnitude(rgbd.velocity, .1f);
                    }
                }

                // Apply various forces
                if (m_connectedBody)
                {
                    Vector3 targetVel = (transform.position - Target.transform.position).normalized * m_forceScale;
                    targetVel += distanceScale * m_lastForceApplied * GetDistanceToTarget();

                    m_connectedBody.rotation = Quaternion.RotateTowards(m_connectedBody.rotation, transform.rotation * Quaternion.Euler(Target.m_upwardRotation), Time.deltaTime * (1 - distanceScale) * 500);
                    m_connectedBody.velocity = Vector3.MoveTowards(m_connectedBody.velocity, targetVel * (Mathf.Sqrt(GetDistanceToTarget()) * m_distanceSpeedScale), Time.deltaTime * (20 + (1 - distanceScale) * 10));

                    m_inputManager.Haptic((1 - distanceScale) / 10);

                    AkSoundEngine.SetRTPCValue("Grab_Distance", GetDistanceToTarget());
                }
            }

            // Update force
            m_lastPos = m_repere.position;
        }
    }
Ejemplo n.º 30
0
 public void ChangeCrowdHype(int value)
 {
     AkSoundEngine.SetRTPCValue("Crowd_Hype", value);
 }