Example #1
0
 // Update is called once per frame
 void Update()
 {
     if (controller.isGrounded && controller.velocity.magnitude > isWalkingThreshold && !isWalking) // si le joueur est sur le sol et a une vitesse supérieur au seuil
     {
         isWalking      = true;                                                                     // alors c'est qu'il marche
         stoppedWalking = false;
         startWalking   = true;
     }
     else if (isWalking && (!controller.isGrounded || controller.velocity.magnitude < isWalkingThreshold)) // si le joueur était en train de marcher et qu'il n'est pas au sol, ou a une vitesse inférieur au seuil
     {
         isWalking      = false;
         stoppedWalking = true; // alors c'est qu'il s'est arrêté de marcher
     }
     if (startWalking)
     {
         //print("start walking");
         WwiseAudioManager.PlayLoopEvent("footsteps", this.gameObject);
         startWalking = false;
     }
     if (stoppedWalking)
     {
         stoppedWalking = false;
         //print("stopped walking");
         WwiseAudioManager.StopLoopEvent("footsteps", this.gameObject);
     }
 }
Example #2
0
    void switchSounds()
    {
        //Tous les sons a switcher sont avec convolver
        for (int i = 0; i < playingObjects.Count; i++)
        {
            if (playingObjects[i].GetComponent <ConvolutionObject>() != null && playingObjects[i].GetComponent <InteractibleObject>().soundEvent != "")
            {
                //Stoppe son du convolver avec switch précédent
                WwiseAudioManager.StopLoopEvent(playingObjects[i].GetComponent <InteractibleObject>().soundEvent, playingObjects[i], true);

                //Lance switch du convolver
                WwiseAudioManager.PlayFiniteEvent(switchType + playingObjects[i].GetComponent <ConvolutionObject>().switchName, playingObjects[i]);

                //Lance son du convolver
                WwiseAudioManager.PlayLoopEvent(playingObjects[i].GetComponent <InteractibleObject>().soundEvent, playingObjects[i], true);
            }

            else if (playingObjects[i].GetComponentInChildren <AudioEventManager>() != null && playingObjects[i].GetComponentInChildren <AudioEventManager>().idleSound)
            {
                GameObject playingNPC = playingObjects[i];

                //Stoppe son Idle (PNJ)
                playingNPC.GetComponentInChildren <AudioEventManager>().SounStopdIdle();

                //play son Idle (PNJ)
                playingNPC.GetComponentInChildren <AudioEventManager>().SoundPlayIdle();
            }
        }
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        WwiseAudioManager.PlayFiniteEvent("ville_calme", this.gameObject);

        //Prends les variables par défaut
        ambientLight    = RenderSettings.ambientLight;
        upLightLight    = GameObject.Find("Lumières").transform.FindChild("Directional_light_up").GetComponent <Light> ().color;
        downLightLight  = GameObject.Find("Lumières").transform.FindChild("Directional_light_down").GetComponent <Light>().color;
        skyBoxLight     = RenderSettings.skybox.GetColor("_Tint");
        FogLight        = RenderSettings.fogColor;
        fogDensityLight = RenderSettings.fogDensity;

        ambientDark    = new Color(25.0f / 255.0f, 32.0F / 255.0f, 36.0F / 255.0f, 0.5F);
        upLightDark    = new Color(8.0F / 255.0f, 16.0F / 255.0f, 66.0F / 255.0f, 0.5F);
        downLightDark  = new Color(58.0f / 255.0f, 0.0F / 255.0f, 68.0F / 255.0f, 0.5F);
        skyBoxDark     = new Color(0.0F / 255.0f, 0.0F / 255.0f, 0.0F / 255.0f, 0.5F);
        FogDark        = new Color(57.0F / 255.0f, 74.0F / 255.0f, 112.0F / 255.0f, 0.5F);
        fogDensityDark = 0.004f;

        upLightStart   = upLightLight;
        downLightStart = downLightLight;
        skyBoxStart    = skyBoxLight;
        ambientStart   = ambientLight;
        fogStart       = FogLight;

        upLightEnd   = upLightDark;
        downLightEnd = downLightDark;
        skyBoxEnd    = skyBoxDark;
        ambientEnd   = ambientDark;
        fogEnd       = FogDark;

        RenderSettings.fog = true;
    }
 public void PlayFiniteEventWithCallBack(string eventName)
 {
     //Stops previous event
     if (idleSound)
     {
         SounStopdIdle();
     }
     WwiseAudioManager.PlayFiniteEvent(eventName, this.transform.parent.gameObject, MyCallbackFunction);
 }
Example #5
0
    public void Start()
    {
        //appel du fragment
        WwiseAudioManager.PlayLoopEvent("fragment_call_" + family.ToString(), this.gameObject, false);

        if (desactivateOnStart)
        {
            this.gameObject.SetActive(false);
        }
    }
Example #6
0
    //Quand le fragment est laché
    public void Drop()
    {
        rigidbody.isKinematic = false;
        transform.parent      = null;

        //stoppe la convolution
        WwiseAudioManager.StopLoopEvent(GetComponent <InteractibleObject>().soundEvent, gameObject);

        GetComponent <levitation>().IsHeld(false);
    }
Example #7
0
    private void Awake()
    {
        if (instance)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
        }

        DontDestroyOnLoad(gameObject);
    }
Example #8
0
 // Ramasse l'objet toPickUp
 public void PickUpObject(GameObject toPickUp)
 {
     if (toPickUp != null)
     {
         print("Interactor:PickUpObject");
         // on racrroche toPickUp a inHandPosition dans la hiérarchie
         inHandObject = toPickUp;
         inHandObject.transform.parent      = inHandPosition.transform;
         inHandObject.transform.position    = inHandPosition.transform.position;
         inHandObject.transform.rotation    = inHandPosition.transform.rotation;
         inHandObject.rigidbody.isKinematic = true;
         handsFull = true;
         WwiseAudioManager.PlayFiniteEvent("interactions_simples_motion", this.gameObject);            // on joue le son correspondant
     }
 }
Example #9
0
    //Ramassage du fragment
    public GameObject OnTouch()
    {
        this.gameObject.SetActive(true);

        GetComponent <levitation>().enabled = true;
        GetComponent <levitation>().IsHeld(true);

        //stoppe appel
        WwiseAudioManager.StopLoopEvent("fragment_call_" + family.ToString(), this.gameObject, false);

        WwiseAudioManager.PlayFiniteEvent("prendre_morceau", gameObject);

        //lance convolution du fragment
        WwiseAudioManager.PlayLoopEvent(GetComponent <InteractibleObject>().soundEvent, gameObject);

        return(this.gameObject);
    }
Example #10
0
    public void DropInHandObject()
    {
        if (inHandObject != null)
        {
            print("Interactor:DropInHandObject");
            WwiseAudioManager.PlayFiniteEvent("interactions_simples_motion", this.gameObject);
            inHandObject.GetComponent <Fragment>().Drop();

            if (hitObject == null)
            {
                inHandObject.GetComponent <Fragment>().Ground();
            }

            handsFull    = false;
            inHandObject = null;
        }
    }
    public GameObject OnPickUp()
    {
        print("SettingPiece:OnPickUp");

        WwiseAudioManager.StopLoopEvent(this.GetComponent <InteractibleObject>().soundEvent, this.gameObject, true);
        WwiseAudioManager.PlayFiniteEvent("convolution_wet_to0", this.gameObject);

        GameObject fragPicked = fragment.OnTouch();

        SoundUniverseManager.removeSoundEvent(this.gameObject);

        fragment = null;
        this.GetComponentInChildren <Renderer>().material = defaultMaterial;
        //audioSource.clip = defaultClip;
        //audioEventName = defaultAudioEventName;
        return(fragPicked);
    }
    public GameObject OnTouch()
    {
        if (!HasFragment())
        {
            WwiseAudioManager.PlayFiniteEvent("toucher_element", this.gameObject);

            if (GetComponent <InteractibleObject>().type == InteractibleType.SettingPiece)
            {
                WwiseAudioManager.PlayFiniteEvent(SoundUniverseManager.switchType + "RI" + switchName, this.gameObject);

                WwiseAudioManager.PlayFiniteEvent("Sfx_RI", this.gameObject);
            }

            return(null);
        }
        else
        {
            return(OnPickUp());
        }
        //soundEevent
    }
    /*
     * public void OnInteract(){
     * print("Parent OnInteract");
     * this.GetComponent<SettingPiece>().OnInteract();
     * }
     */
    public void OnAddingFragment(Fragment fragment)
    {
        if (this.GetComponent <Blend>() != null)
        {
            this.GetComponent <Blend>().enabled = false;
        }
        this.GetComponent <InteractibleObject> ().soundEvent = fragment.GetComponent <InteractibleObject> ().soundEvent;

        //fragment.transform.parent = this.transform;

        //print("SettingPiece:OnAddingFragment:" + GetComponent<InteractibleObject>().type);
        this.fragment = fragment;
        //activatedMaterial = fragment.material;
        this.GetComponentInChildren <Renderer>().material = fragment.material;
        //this.audioSource.clip = fragment.GetClip();
        // this.audioEventName = fragment.audioEventName;

        //AkSoundEngine.SetRTPCValue ("binaural_to_convolver", 100);
        //fragment.Drop ();
        //AkSoundEngine.SetSwitch("Elements_decor", "Batiment_1", inHandObject.gameObject);

        SoundUniverseManager.addSoundEvent(this.gameObject);

        WwiseAudioManager.PlayFiniteEvent("linker_morceau", this.gameObject);

        WwiseAudioManager.PlayFiniteEvent(SoundUniverseManager.switchType + switchName, this.gameObject);

        WwiseAudioManager.PlayLoopEvent(fragment.GetComponent <InteractibleObject>().soundEvent, this.gameObject, true);
        WwiseAudioManager.PlayFiniteEvent("convolution_wet_to100", this.gameObject);



        if (GetComponent <InteractibleObject>().type == InteractibleType.NPC)
        {
            this.GetComponent <Musicien>().OnAddingFragment(fragment);
            GetComponentInChildren <AudioEventManager>().SoundRemovedIdle();
            GetComponentInChildren <AudioEventManager>().idleSound = false;
        }
    }
Example #14
0
 public void EmitSound()// émission du son du passant
 {
     WwiseAudioManager.PlayFiniteEvent(audioEventName, this.gameObject);
     print("Emit Sound");
 }
 public void SounStopdIdle()
 {
     WwiseAudioManager.StopLoopEvent(audioName.ToString() + "_idle", this.transform.parent.gameObject);
 }
 /*
  * Sound events
  */
 public void SoundPlayIdle()
 {
     WwiseAudioManager.PlayFiniteEvent(SoundUniverseManager.switchType + "_mood", this.transform.parent.gameObject);
     WwiseAudioManager.PlayLoopEvent(audioName.ToString() + "_idle", this.transform.parent.gameObject);
 }
Example #17
0
 //Quand le fragment est posé au sol
 public void Ground()
 {
     WwiseAudioManager.PlayFiniteEvent("lacher_morceau", gameObject);
     //relance appel du fragment
     WwiseAudioManager.PlayLoopEvent("fragment_call_" + family.ToString(), gameObject, false);
 }