protected IEnumerator BlendingProcedure()
        {
            Debug.Log("Start blending...");
            ParamRef[] previousParams = new ParamRef[defaultParams.Count];
            defaultParams.CopyTo(previousParams); // Copy it to create new references

            for (float i = 0; i < blendingTime;)
            {
                float currentBlend = i / blendingTime; // The x position in the blending curve
                foreach (ParamRef paramRef in previousParams)
                {
                    float targetValue  = float.Parse(parameters[paramRef.Name]);                                    // The value we'll have at the end
                    float startValue   = paramRef.Value;                                                            // The value we'd at the beginning
                    float currentValue = Mathf.Lerp(startValue, targetValue, blendingCurve.Evaluate(currentBlend)); // The value we want now (linear interpolation)

                    targetEmitter.SetParameter(paramRef.Name, currentValue);
                    Debug.Log(paramRef.Name + " : " + currentValue);
                }

                i += BlendingPrecision;
                yield return(new WaitForSeconds(BlendingPrecision));
            }

            if (applyLastValue)
            {
                foreach (ParamRef paramRef in previousParams)
                {
                    float targetValue = float.Parse(parameters[paramRef.Name]); // The value we'll have at the end
                    targetEmitter.SetParameter(paramRef.Name, targetValue);
                    Debug.Log(paramRef.Name + " : " + targetValue);
                }
            }
            BlendingCoroutine = null; // Reset the reference
        }
Exemple #2
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         backgroundMusic.SetParameter("Situatie", 2, false);
         //playerControl.footsteps = stamVoetjes;
     }
 }
Exemple #3
0
    private void Start()
    {
        windSound.SetParameter("Wind", 0f);

        GameObject playerGO = GameObject.FindWithTag("Player");

        player = playerGO.transform;
        height = player.position.y;
    }
 /// <summary>
 /// Unlocks the player and stops the travel routine.
 /// </summary>
 public void AtIslandArrival()
 {
     if (eventWavesEmitter != null)
     {
         eventWavesEmitter.SetParameter("Fade_Out", 1f);
     }
     FindObjectOfType <PlayerSpawnPositionBasedOnLastScene>().UnlockPlayer();
     shipCamera.m_Priority = 9;
     IslandLoader.DisplayIslandType();
 }
Exemple #5
0
    private void FixedUpdate()
    {
        rb.AddForce(forceToApply);
        Vector3 temp = rb.velocity;

        temp.z      = speed;
        rb.velocity = temp;

        emitter.SetParameter("CVSpeed", Mathf.Clamp(rb.velocity.magnitude * 500, 0, 1000));
        emitter.SetParameter("Portance", Mathf.Clamp(rb.velocity.y * 500, 0, 5000));
    }
Exemple #6
0
 private void ChangeMusicAccordingToRight()
 {
     if (player)
     {
         float NormalizedRight = (player.gameObject.transform.position.x - player.boundary.xMin) / (player.boundary.xMax - player.boundary.xMin);
         emitter.SetParameter("Right", NormalizedRight);
     }
     else
     {
         InitPlayer();
     }
 }
 public void PlayVoiceLine(float distanceToIla)
 {
     Debug.Log("Borde spela voiceline");
     voiceLineMiscEmitter.Play();
     if (distanceToIla < closeFarThreshold)
     {
         voiceLineMiscEmitter.SetParameter("Voice Line", currentClose);
     }
     else
     {
         voiceLineMiscEmitter.SetParameter("Voice Line", currentFar);
     }
 }
Exemple #8
0
    private void SetEngineParameters()
    {
        float speed = 0;

        PhysicsUtilities.ScaleValueWithSpeed(ref speed, 0, 1, Handling.RB, Handling.MaxSpeed);
        Engine.SetParameter("Speed", speed);

        Engine.SetParameter("Force", Handling.ThrustInput);

        if (Handling.IsCarving)
        {
            float driftAmount = Mathf.Clamp(Mathf.Abs(Handling.TurnInput), 0.4f, 1.0f);
            Engine.SetParameter("Drift", driftAmount);
        }
    }
Exemple #9
0
    // Update is called once per frame
    void Update()
    {
        platformCurrentSpeed = Mathf.Abs(wplat.rotationSpeed);

        if (platformCurrentSpeed >= 0.02f)
        {
            Target.SetParameter("platVel", platformCurrentSpeed);
            //	Debug.Log ("Changing parameter to: " + platformCurrentSpeed);
            //	Debug.Log (wplat.WheelBehavior);
        }



        //make "LevelReset.reset" a static boolean to fix audio bug when player dies
    }
    public void Interact()
    {
        ItemDependencies id = gameObject.GetComponent <ItemDependencies>();

        if (id)
        {
            if (id.CheckDependency(Inventory.instance))
            {
                sceneSwitcher.ActivateSceneSwitch(targetSceneBuildIndex);
                enterSound.Play();
                Debug.Log("ENTER SOUND");
            }
            else
            {
                if (denialVoiceLineAlternatives.Length > 0 && !denialVoiceLine.IsPlaying())
                {
                    int i = Random.Range(0, denialVoiceLineAlternatives.Length);

                    denialVoiceLine.Play();
                    denialVoiceLine.SetParameter("Voice Line", denialVoiceLineAlternatives[i]);
                }
            }
        }

        else
        {
            enterSound.Play();
            Debug.Log("ENTER SOUND");
            sceneSwitcher.ActivateSceneSwitch(targetSceneBuildIndex);
        }
    }
Exemple #11
0
 public void SetIdleSound(float speed)
 {
     if (fmodOn)
     {
         _emitter.SetParameter("speed", speed);
     }
 }
    void PlayerAiming()
    {
        if (!jumpCharging.IsPlaying())
        {
            chargeSnapshot.Play();
        }
        currentlyAiming = true;

        //Setting the aim art
        float aimRotation = -(Mathf.Atan2(input.playerAim.x, input.playerAim.y) * 180 / Mathf.PI);

        aim.eulerAngles = new Vector3(0, 0, aimRotation);

        //Building Jump Force
        jumpingForce += jumpingForceTimer;


        //Setting UI canon aim slider
        canonAimSlider.value = jumpingForce;

        //Setting bullet time

        Time.timeScale      = timeSlowdown;
        Time.fixedDeltaTime = .02f * Time.timeScale;



        //FMOD Charge
        if (!jumpCharging.IsPlaying())
        {
            jumpCharging.Play();
        }

        jumpCharging.SetParameter("ChargeUp", (jumpingForce - jumpingForceMinMax.x / (jumpingForceMinMax.y - jumpingForceMinMax.x)));
    }
Exemple #13
0
    // Update is called once per frame

    void Update()
    {
        if (!GetComponentInParent <TargetPositionController> ().dodoDead)
        {
            if (!GetComponent <StudioEventEmitter> ().IsPlaying())
            {
                GetComponent <StudioEventEmitter> ().Play();
            }

            float d = Vector3.Distance(dodo.position, skorpion.position);



            if (skorpion.GetComponent <Pathfinding> ().followDodo)
            {
                dist = d * 1.2f;
            }
            else
            {
                dist = 100f;
            }

            soundScript.SetParameter("Distance", dist);
        }
        else
        {
            GetComponent <StudioEventEmitter> ().Stop();
        }
    }
    public static float IncrementParameter(this StudioEventEmitter e, string name, float val)
    {
        float p = e.GetParameter(name) + val;

        e.SetParameter(name, p);
        return(p);
    }
Exemple #15
0
 private void Update()
 {
     if (Value != _value)
     {
         _value = Value;
         emitter.SetParameter(parameter, Value);
     }
 }
 // Update is called once per frame
 void Update()
 {
     gameBgm.SetParameter("Hype", hype / 100f);
     if (hype > 0f)
     {
         hype -= 7.5f * Time.deltaTime;
     }
 }
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         //start beer muziek
         backgroundMusic.SetParameter("Situatie", whichSituation, false);
     }
 }
Exemple #18
0
 public void Interact()
 {
     if (!see.IsPlaying())
     {
         see.Play();
         see.SetParameter("Voice Line", voiceLine);
     }
 }
Exemple #19
0
    public void SetIsTalking(bool talk)
    {
        animator.SetBool("IsTalking", talk);

        if (!talk)
        {
            if (eventSetting.Length > 0)
            {
                AudioStatics.StopEvent(audioEventEmitter);
            }


            return;
        }



        eventSetting = "event:/vo_char";

        switch (type)
        {
        case HeadType.dude:
            eventSetting += "2";
            break;

        case HeadType.girl:
            eventSetting += "1";
            break;

        case HeadType.asiangirl:
            eventSetting += "3";
            break;

        case HeadType.duck:
            eventSetting += "4";
            break;
        }
        eventSetting += loopType == 0 ? "_slow_loop" : "_fast_loop";

        audioEventEmitter.Event = eventSetting;



        AudioStatics.PlayEvent(audioEventEmitter);
        audioEventEmitter.SetParameter("Progress", 0);
    }
Exemple #20
0
    public void NextSky(GameObject areaObject)
    {
        countSky++;

        if (countSky == 3)
        {
            musicEarth.SetParameter("Céu", 1);
            Destroy(areaObject);
        }
    }
Exemple #21
0
    // Update is called once per frame
    void Update()
    {
        if (paramValue == 0.0f && soundscape != null)
        {
            soundscape.SetParameter("SupermegaMago", paramValue);
        }

        if (!playedFullBarSound && _throw.barFill.fillAmount == 1.0f)
        {
            playedFullBarSound = true;
            FMODUnity.RuntimeManager.PlayOneShot("event:/Efeitos/orbs/Barra Cheia");
        }

        if (InputManager.GetKeyDown(playerInput.controllerScheme, "Action2"))
        {
            if (_throw.barFill.fillAmount == 1.0f)
            {
                full = true;
                //this.gameObject.transform.GetChild(0).gameObject.GetComponent<Collider>().enabled = false;
                //this.GetComponent<Rigidbody>().useGravity = false;
                Debug.Log("Supermago iniciado");
                paramValue = 0.0f; //liga baixo

                this.transform.GetChild(11).gameObject.SetActive(true);
            }
        }
        if (full)
        {
            _throw.barFill.fillAmount -= 0.2f * Time.deltaTime;
            if (_throw.barFill.fillAmount == 0.0f)
            {
                Debug.Log("Fim suoermago");
                paramValue = 1.0f; //desliga baixo
                if (soundscape != null)
                {
                    soundscape.SetParameter("SupermegaMago", 1.0f);
                }
                full = false;
                playedFullBarSound = false;
                this.transform.GetChild(11).gameObject.SetActive(false);
                // this.gameObject.transform.GetChild(0).gameObject.GetComponent<Collider>().enabled = true;
                //this.GetComponent<Rigidbody>().useGravity = true;
            }
        }
    }
        protected override void ReactToEvent(UnityFunction unityFunction)
        {
            StudioEventEmitter emitter = AudioManager.Instance.EventPaths.GetEmitter(emitterType);

            foreach (KeyValuePair <string, float> pair in parameters[unityFunction].Parameters)
            {
                emitter.SetParameter(pair.Key, pair.Value);
            }
        }
 private void FixedUpdate()
 {
     if (GameManager.instance.gameOver)
     {
         windEvent.Stop();
         return;
     }
     windEvent.SetParameter("Velocity", playerRigid.velocity.magnitude / maxVelocitySpeed);
 }
 private void OnTriggerExit(Collider other)
 {
     if (other.gameObject.CompareTag("Player") && ride == true)
     {
         player.gameObject.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.None;
         player.gameObject.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeRotation;
         player.transform.parent = oldParent;
         tut = false;
         turtlecontrol.mounted = false;
         mounted = false;
         backgroundMusic.SetParameter("Situatie", 0, false);
         foreach (StudioEventEmitter emit in riverSounds)
         {
             emit.enabled = true;
         }
         water.spawnLoc = secondRespawn;
     }
 }
Exemple #25
0
 public void changeParam(EnableEnum enable)
 {
     if (!emitter)
     {
         return;
     }
     if (enable == EnableEnum.NoChange)
     {
         return;
     }
     else if (enable == EnableEnum.Enable && emitter)
     {
         emitter.SetParameter(paramater, 1f);
     }
     else if (enable == EnableEnum.Disable && emitter)
     {
         emitter.SetParameter(paramater, 0f);
     }
 }
Exemple #26
0
    public void UpdateMatchRate(float _waveMatching)
    {
        sineEvent.SetParameter("Progress", _waveMatching);
        waveMatching = _waveMatching;

        foreach (Head_AniScript head in heads)
        {
            head.UpdateMatch(_waveMatching);
        }
    }
    public bool IsGrounded()
    {
        if (calculated)
        {
            return(grounded);
        }

        calculated = true;
        Collider2D[] colliders = Physics2D.OverlapBoxAll(myCollider.bounds.center, myCollider.bounds.size, 0.0f);

        for (int i = 0; i < colliders.Length; i++)
        {
            if (((1 << colliders[i].gameObject.layer) & groundMask) != 0)
            {
                soundEmitter.SetParameter("Ground", 1);
                return(grounded = true);
            }
        }
        soundEmitter.SetParameter("Ground", 0);
        return(grounded = false);
    }
Exemple #28
0
    void AdjustTime() {
        if (!running) {
            return;
        }
        float ratio = (currentTimer / maxTimer);
        FillImage.fillAmount = 1 - ratio;
        TimeIndicator.transform.position = ratio * TimeBot.position + (1 - ratio) * TimeTop.position;

        _emitter.SetParameter("DirtLevel", 1f -ratio);
        

    }
Exemple #29
0
 // Start is called before the first frame update
 void Start()
 {
     cam.m_Transitions.m_OnCameraLive.AddListener(
         (a, b) =>
     {
         if (!_HasSet)
         {
             _HasSet = true;
             emitter.SetParameter("Room", room);
         }
     });
 }
Exemple #30
0
    void Update()
    {
        var button = "J1Fire1";

        if (gameObject.tag == "Player2")
        {
            button = "J2Fire1";
        }
        if (!grappleShot && CrossPlatformInputManager.GetButtonDown(button))
        {
            grappleShot = true;
            GrapplingHook.transform.position = grappleLaunch.position;
            GrapplingHook.SetActive(true);
            launchDirection = (transform.localScale.x > 0 ? Vector3.right : Vector3.left) + Vector3.up;
            grapplingSounds.SetParameter("State", 2);
            grapplingSounds.Play();
        }
        if (grappleShot && !grappleHit)
        {
            GrapplingHook.transform.position = Vector2.Lerp(GrapplingHook.transform.position, GrapplingHook.transform.position + launchDirection, Time.deltaTime * MaxGraplingShootSpeed);
            if (Vector2.Distance(GrapplingHook.transform.position, transform.position) > MaxGrapplingHookLength)
            {
                DespawnHook();
            }
            if (Physics2D.OverlapCircle(GrapplingHook.transform.position, GrappleProximity, GroundLayer))
            {
                grappleHit = true;
                moveController.LockMovement = true;
                hingeSwing.enabled          = true;

                hingeSwing.connectedBody    = playerRigidbody;
                playerRigidbody.constraints = RigidbodyConstraints2D.None;
            }

            UpdateTetherPosition();
        }
        if (grappleHit)
        {
            if (CrossPlatformInputManager.GetButtonDown(button))
            {
                DespawnHook();
            }

            if (Vector2.Distance(grappleLaunch.position, GrapplingHook.transform.position) > MinimumDistanceFromGrapple)
            {
                transform.position = Vector2.MoveTowards(transform.position, GrapplingHook.transform.position, MaxGraplingRetractSpeed);
            }


            UpdateTetherPosition();
        }
    }