SetSwitch() public static method

public static SetSwitch ( string in_pszSwitchGroup, string in_pszSwitchState, UnityEngine in_gameObjectID ) : AKRESULT
in_pszSwitchGroup string
in_pszSwitchState string
in_gameObjectID UnityEngine
return AKRESULT
Ejemplo n.º 1
0
    public void PlayOnomatope()
    {
        switch (character)
        {
        case CharacterType.Artisan:
            AkSoundEngine.SetSwitch("NPC_pick", "Artisan", gameObject);
            break;

        case CharacterType.Paysan:
            AkSoundEngine.SetSwitch("NPC_pick", "Paysan", gameObject);
            break;

        case CharacterType.Pecheur:
            AkSoundEngine.SetSwitch("NPC_pick", "Pecheur", gameObject);
            break;

        case CharacterType.Responsable:
            AkSoundEngine.SetSwitch("NPC_pick", "Sage", gameObject);
            break;

        case CharacterType.Healer:
            AkSoundEngine.SetSwitch("NPC_pick", "Chaman", gameObject);
            break;

        case CharacterType.Troubadour:
            AkSoundEngine.SetSwitch("NPC_pick", "Troubadour", gameObject);
            break;

        case CharacterType.Etranger:
            AkSoundEngine.SetSwitch("NPC_pick", "Etranger", gameObject);
            break;
        }
        CheckNPCMoodForOnomatope();
        AkSoundEngine.PostEvent("NPC_Discussion_start", gameObject);
    }
Ejemplo n.º 2
0
    private void PlayMusic()
    {
        switch (CurMusic)
        {
        case MusicType.Village:
            Debug.Log("switching to VILLAGE music");
            AkSoundEngine.SetRTPCValue("village_karma", 0, gameObject);
            AkSoundEngine.SetSwitch("music_switch", "village", gameObject);
            break;

        case MusicType.Ceremony:
            Debug.Log("switching to CEREMONY music");
            AkSoundEngine.SetSwitch("music_switch", "festival", gameObject);
            break;

        case MusicType.Battle:
            Debug.Log("switching to BATTLE music");
            AkSoundEngine.SetSwitch("music_switch", "battle", gameObject);
            break;

        case MusicType.Menu:
            Debug.Log("switching to MENU music");
            AkSoundEngine.SetSwitch("music_switch", "menu", gameObject);
            break;
        }
    }
Ejemplo n.º 3
0
    public virtual void TakeDamage(int damage)
    {
        if (damage > 0)
        {
            GameObject    g  = GameObject.FindGameObjectWithTag("CombatManager");
            CombatManager cm = g.GetComponent <CombatManager>();
            (cm.GetGroupFighterOfFighter(this)).OneFighterTookDamage();

            bHasTookDamage = true;
            justTookDamage = true;
        }

        nCurrentHealth -= damage;
        bHasbeenAttcked = true;


        if (nCurrentHealth <= 0)
        {
            nCurrentHealth = 0;
            AkSoundEngine.SetSwitch("Tension", "T4", GameObject.FindGameObjectWithTag("MainCamera"));
        }
        if (nCurrentHealth > nHealthMax)
        {
            nCurrentHealth = nHealthMax;
        }
    }
Ejemplo n.º 4
0
 public void scene2End(int layer)
 {
     scores[layer - 9]++;
     gameCanvas.transform.GetChild(layer - 9).GetChild(0).GetChild(3).gameObject.GetComponent <UnityEngine.UI.Text>().text = scores[layer - 9].ToString();
     if (scores[layer - 9] >= maxPoints)
     {
         AkSoundEngine.StopAll(gameObject);
         AkSoundEngine.PostEvent("Gate_Opera", gameObject);
         AkSoundEngine.SetSwitch("Music", "Start", gameObject);
         gameCanvas.SetActive(false);
         teamCanvas.SetActive(false);
         victoryCanvas.SetActive(true);
         victoryCanvas.transform.GetChild(layer - 7).gameObject.SetActive(true);
         for (int i = 1; i < 5; i++)
         {
             if (i == layer - 8)
             {
                 NetworkServerManager.getInstance().ServerStringMessageSender(i, "Won");
             }
             else
             {
                 NetworkServerManager.getInstance().ServerStringMessageSender(i, "Lost");
             }
         }
     }
     else
     {
         LoadMatchmakingScene();
     }
 }
Ejemplo n.º 5
0
    private void PlaySound()
    {
        switch (type)
        {
        case PromptType.Ingredient:
            if (amount == 1)
            {
                AkSoundEngine.SetSwitch("Number", "One", GameObject.FindGameObjectWithTag("Prompt"));
            }
            if (amount == 2)
            {
                AkSoundEngine.SetSwitch("Number", "Two", GameObject.FindGameObjectWithTag("Prompt"));
            }
            if (ingName == "flour")
            {
                AkSoundEngine.SetSwitch("Ingredients", "Flour", GameObject.FindGameObjectWithTag("Prompt"));
            }
            if (ingName == "sugar")
            {
                AkSoundEngine.SetSwitch("Ingredients", "Sugar", GameObject.FindGameObjectWithTag("Prompt"));
            }
            if (ingName == "salt")
            {
                AkSoundEngine.SetSwitch("Ingredients", "Salt", GameObject.FindGameObjectWithTag("Prompt"));
            }
            if (ingName == "butter")
            {
                AkSoundEngine.SetSwitch("Ingredients", "Butter", GameObject.FindGameObjectWithTag("Prompt"));
            }

            AkSoundEngine.PostEvent("IngredientPrompt", GameObject.FindGameObjectWithTag("Prompt"));
            break;
        }
    }
Ejemplo n.º 6
0
    public static void PlayBreakSound(byte type, GameObject gameObject)
    {
        string material = NBTGeneratorManager.GetMeshGenerator(type).soundMaterial.ToString();

        AkSoundEngine.SetSwitch("Materials", material, gameObject);
        AkSoundEngine.PostEvent("Player_Break", gameObject);
    }
Ejemplo n.º 7
0
 private void SilenceAll()
 {
     foreach (var item in groups)
     {
         AkSoundEngine.SetSwitch(item, "silent", musicObject);
     }
 }
Ejemplo n.º 8
0
    void TriggerFootstep()
    {
        if (isOnTerrain)
        {
            GetTerrainTexture();

            if (valor1 > 0 && fsSwitchState1 != "")
            {
                AkSoundEngine.SetSwitch(fsSwitchGroup, fsSwitchState1, gameObject);
                AkSoundEngine.PostEvent(fsEventName, gameObject);
            }
            if (valor2 > 0 && fsSwitchState2 != "")
            {
                AkSoundEngine.SetSwitch(fsSwitchGroup, fsSwitchState2, gameObject);
                AkSoundEngine.PostEvent(fsEventName, gameObject);
            }
            if (valor3 > 0 && fsSwitchState3 != "")
            {
                AkSoundEngine.SetSwitch(fsSwitchGroup, fsSwitchState3, gameObject);
                AkSoundEngine.PostEvent(fsEventName, gameObject);
            }
            if (valor4 > 0 && fsSwitchState4 != "")
            {
                AkSoundEngine.SetSwitch(fsSwitchGroup, fsSwitchState4, gameObject);
                AkSoundEngine.PostEvent(fsEventName, gameObject);
            }
        }
        else
        {
            AkSoundEngine.SetSwitch(fsSwitchGroup, fsSwitchDefault, gameObject);
            AkSoundEngine.PostEvent(fsEventName, gameObject);
        }
    }
Ejemplo n.º 9
0
    public override void OnDragStart()
    {
        base.OnDragStart();
        //Wwise switch control - chooses the ingredient and plays the pickup sound based on that
        if (ingredientName == "flour")
        {
            AkSoundEngine.SetSwitch("Ingredient_Pickup", "Flour", GameObject.FindGameObjectWithTag("Ingredients"));
        }
        if (ingredientName == "butter")
        {
            AkSoundEngine.SetSwitch("Ingredient_Pickup", "Butter", GameObject.FindGameObjectWithTag("Ingredients"));
        }
        if (ingredientName == "sugar")
        {
            AkSoundEngine.SetSwitch("Ingredient_Pickup", "Sugar", GameObject.FindGameObjectWithTag("Ingredients"));
        }
        if (ingredientName == "salt")
        {
            AkSoundEngine.SetSwitch("Ingredient_Pickup", "Salt", GameObject.FindGameObjectWithTag("Ingredients"));
        }

        AkSoundEngine.PostEvent("Ingredient_Pickup", GameObject.FindGameObjectWithTag("Ingredients"));

        initialPosition = transform.position;
        GetComponent <Collider2D>().enabled = true;
        ToggleSprite();

        GetComponentInChildren <SpriteRenderer>().sortingOrder = 3;
    }
Ejemplo n.º 10
0
 private void OnTriggerExit(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         AkSoundEngine.SetSwitch(SwitchGroup, ExitSwitch, player);
     }
 }
Ejemplo n.º 11
0
    void Start()
    {
        GameObject modelGo = Instantiate(availableModels[modelIndex], transform.position, transform.rotation, transform);
        PlayerGFX  model   = modelGo.GetComponent <PlayerGFX>();

        if (modelIndex <= 1)
        {
            damageRecieveSound = "Recieve_duck";
        }
        else
        {
            damageRecieveSound = "Recieve_frog";
        }
        GetComponentInChildren <ImpactCollider>().gameObject.layer = LayerMask.NameToLayer("ImpactColl" + playerNumber);
        worldspaceImg.sprite = availableSprites[playerNumber - 1];
        swingPivot           = model.swingPivot;
        punch              = model.punch;
        startingPos        = transform.position;
        cController        = GetComponent <CharacterController>();
        playerAxisX        = "HorizontalP" + playerNumber;
        playerAxisY        = "VerticalP" + playerNumber;
        playerAxisHit      = "HitP" + playerNumber;
        playerAxisInteract = "Grab-ThrowP" + playerNumber;
        animator           = GetComponentInChildren <Animator>();
        currentState       = State.idle;
        groundLayer        = LayerMask.GetMask("Ground");
        currentGravity     = baseGravity;
        GetAnimationTimes();
        AkSoundEngine.SetSwitch("Arma_selector", "Punch", gameObject);
    }
Ejemplo n.º 12
0
    public void PlayOnce()
    {
        var groups = SourceData.EventSwitchGroups;

        foreach (var grp in groups)
        {
            AKRESULT akresult = AkSoundEngine.SetSwitch(grp.Group, grp.States[grp.selectedIndex], SelfEntity);
            if (EnableEmitterLog)
            {
                DebugUtil.MyLog(string.Format("[Emitter] set akgroup:{0} akstate:{1} akresult:{2}", grp.Group,
                                              grp.States[grp.selectedIndex], akresult));
            }
        }

        var currEvt = SourceData.EventCfg.Event;

        //     EventActionData.StopLastExcutedEvent(this);
        AkSoundEngine.PostEvent(currEvt, SelfEntity);
        EventActionData.lastExcutedEvent = currEvt;
        EventActionData.unStopedEvents.Add(currEvt);

        if (EnableEmitterLog)
        {
            DebugUtil.MyLog("[Emitter] post event:" + currEvt);
        }
    }
 public override void Pickup(PlayerController player)
 {
     base.Pickup(player);
     AkSoundEngine.SetSwitch("WPN_Guns", "Lute", base.gameObject);
     AkSoundEngine.PostEvent("Play_WPN_gun_shot_01", base.gameObject);
     player.OnNewFloorLoaded += this.ResetMusic;
 }
Ejemplo n.º 14
0
 void Start()
 {
     AkSoundEngine.SetState("Game", "Menu");
     AkSoundEngine.SetState("PlayerLife", "None");
     AkSoundEngine.SetSwitch("Gameplay", "Exploration", gameObject);
     AkSoundEngine.PostEvent("MUS_START", gameObject);
 }
Ejemplo n.º 15
0
 void OnTriggerStay(Collider other)
 {
     if (other.tag == "Weapon")
     {
         AkSoundEngine.SetSwitch(switchGroupName, switchStateNameInside, other.gameObject);
     }
 }
Ejemplo n.º 16
0
    //The event are triggerEnter,so I will only enable the collider after the chatacter done moving


    void Start()
    {
        turnNumber    = 1;
        xp            = 23;
        level         = 01;
        m_Collider    = GetComponent <CapsuleCollider>();
        characterAnim = GetComponent <Animator>();
        this.HP       = health;
        this.isAlive  = true;

        extraRollAmount = 0;

        audioSource.GetComponent <AudioSource>();


        gold = 10;
        UpdatePlayerStats();

        IntroCam.gameObject.SetActive(false);

        cameraEvent?.Invoke(IntroCam);

        debuffParticles.gameObject.SetActive(false);
        buffParticles.gameObject.SetActive(false);

        AkSoundEngine.SetSwitch("Music_Switch_Pro", "nonCombat_Switch", gameObject);
        AkSoundEngine.PostEvent("Music_Switch_Pro", gameObject);
    }
Ejemplo n.º 17
0
    //Collision SHIT
    public void BowlingCollision(Collision collision, bowlingBallColSurface surfaceCollided)
    {
        GameObject placeholder = collisionQueueDebug.Dequeue();

        placeholder.transform.position = collision.contacts[0].point;
        collisionQueueDebug.Enqueue(placeholder);
        switch (surfaceCollided)
        {
        case (bowlingBallColSurface.fabric):
            AkSoundEngine.SetSwitch("BowlingBallCol", "fabric", placeholder);
            break;

        case (bowlingBallColSurface.metal):
            AkSoundEngine.SetSwitch("BowlingBallCol", "metal", placeholder);
            break;

        case (bowlingBallColSurface.quil):
            AkSoundEngine.SetSwitch("Quil_Col", "single", placeholder);
            AkSoundEngine.SetSwitch("BowlingBallCol", "quil", placeholder);
            break;

        case (bowlingBallColSurface.stone):
            AkSoundEngine.SetSwitch("BowlingBallCol", "stone", placeholder);
            break;

        case (bowlingBallColSurface.wood):
            AkSoundEngine.SetSwitch("BowlingBallCol", "wood", placeholder);
            break;
        }

        AkSoundEngine.PostEvent("Play_BBCol", placeholder);
    }
Ejemplo n.º 18
0
    private void UpdateDetection()
    {
        if (seahorses.Count == 0)
        {
            // You won the game!
            gameWon = 2.5f;
            return;
        }
        float closest   = CheckNearest();
        float detection = 0f;

        if (closest < failurePoint)
        {
            AkSoundEngine.StopPlayingID(_themeSong);
            UnityEngine.SceneManagement.SceneManager.LoadScene("End");
        }
        if (closest < dangerThreshold)
        {
            closest  -= failurePoint;
            detection = 1f - (closest / (dangerThreshold - failurePoint));
            if (detection > 0.2f)
            {
                AkSoundEngine.SetSwitch("Danger", "Nearby", gameObject);
            }
            else
            {
                AkSoundEngine.SetSwitch("Danger", "Clean", gameObject);
            }
            detectionLeftMeter.color  = Color.Lerp(Color.yellow, Color.red, detection);
            detectionRightMeter.color = Color.Lerp(Color.yellow, Color.red, detection);
        }

        detectionLeftMeter.fillAmount  = detection;
        detectionRightMeter.fillAmount = detection;
    }
Ejemplo n.º 19
0
    void Update()
    {
        transform.position = new Vector3(transform.position.x + (Input.GetAxis("Horizontal") / 10), transform.position.y, transform.position.z);

        float xpos = startpos.x - transform.position.x;


        // Event2: "PressSpace" kaldes ved tryk af knap
        if (Input.GetKeyDown(KeyCode.Space))
        {
            AkSoundEngine.PostEvent("PressSpace", gameObject);
            transform.localScale = new Vector3(Random.Range(0.2f, 1.5f), Random.Range(0.2f, 1.5f), Random.Range(0.2f, 1.5f));
        }

        // GameSync1 (Switch): "LeftRight" skifter mellem PressSpace-filer ud fra binær x
        // GameSync2 (State): "LeftRight" fader mellem Ambience-filer ud fra binær x
        if (transform.position.x <= startpos.x)
        {
            AkSoundEngine.SetSwitch("LeftRight", "Left", gameObject);
            AkSoundEngine.SetState("LeftRight", "Left");
        }
        else if (transform.position.x > startpos.x)
        {
            AkSoundEngine.SetSwitch("LeftRight", "Right", gameObject);
            AkSoundEngine.SetState("LeftRight", "Right");
        }

        // GameSync3 (RTPC): "XPosition" lader x som talværdi styre parametre for PressSpace & Ambience
        AkSoundEngine.SetRTPCValue("XPosition", xpos);
    }
 void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag.Equals("Player"))
     {
         AkSoundEngine.SetSwitch("Footstep_Switch", "Inside", other.gameObject);
     }
 }
Ejemplo n.º 21
0
    public void Touched()
    {
        if (!on)
        {
            on         = true;
            currentPos = 0;
            AkSoundEngine.PostEvent(nameEventUnMute.Id, sound_Manager);
            Debug.Log("Unmute");
        }
        else if (currentPos == switchs.Count)
        {
            on = false;
            AkSoundEngine.PostEvent(nameEventMute.Id, sound_Manager);
            Debug.Log("Mute");
            currentPos = 0;
        }

        if (currentPos != switchs.Count && switchs.Count != 0)
        {
            AkSoundEngine.SetSwitch(switchs[currentPos].GroupId, switchs[currentPos].Id, sound_Manager);
            currentPos++;
        }
        else
        {
            Debug.Log("Error : did not have any state ", this.gameObject);
        }
    }
    public void PlayFootstep(string animParameters)
    {
        string[] parameters = animParameters.Split('~');

        // Set Switch
        if (!_hasSetSwitch)
        {
            // walk = 0, speed = 1
            if (parameters[1] == "walk")
            {
                AkSoundEngine.SetSwitch(_speedSwitchGroup, _walkSwitch, this.gameObject);
            }
            else if (parameters[1] == "run")
            {
                AkSoundEngine.SetSwitch(_speedSwitchGroup, _walkSwitch, this.gameObject);
            }
            else
            {
                Debug.Log("Invalid switch for footsteps.");
            }

            _hasSetSwitch = true;
        }

        // Play Footstep ( K'iin )
        if (parameters[0] == "K'iin")
        {
            AkSoundEngine.PostEvent(_kiinPlayFootstep, gameObject);
            // Debug.Log("Triggered footstep - K'iin.");
        }

        // Play Footstep ( Healer )
        else if (parameters[0] == "Healer")
        {
            AkSoundEngine.PostEvent(_healerPlayFootstep, gameObject);
            // Debug.Log("Triggered footstep - Healer.");
        }

        // Play Footstep ( Ranger )
        else if (parameters[0] == "Ranger")
        {
            AkSoundEngine.PostEvent(_rangerPlayFootstep, gameObject);
            // Debug.Log("Triggered footstep - Ranger.");
        }

        // Play Footstep ( Tank )
        else if (parameters[0] == "Tank")
        {
            AkSoundEngine.PostEvent(_tankPlayFootstep, gameObject);
            // Debug.Log("Triggered footstep - Tank.");
        }

        // Play Footstep ( Boss )
        else if (parameters[0] == "Boss")
        {
            AkSoundEngine.PostEvent(_deathGodPlayFootstep, gameObject);
            // Debug.Log("Triggered footstep - Tank.");
        }
    }
Ejemplo n.º 23
0
    public bool SpecialObjectEvent(InteractObject obj)
    {
        if (!IsWaitingObject)
        {
            isQuestOnomatope = false;
            return(false);
        }
        bool returnVal = false;

        switch (obj.objectType)
        {
        case InteractObject.ObjectType.Baton:
            if (character == PnjManager.CharacterType.Artisan)
            {
                returnVal = true;
                EventManager.Instance.UpdateEvent(EventDatabase.EventType.ObjectBoisToArtisan, 1);
            }
            break;

        case InteractObject.ObjectType.Plante:
            if (character == PnjManager.CharacterType.Healer)
            {
                returnVal = true;
                EventManager.Instance.UpdateEvent(EventDatabase.EventType.ObjectPlanteToShaman, 1);
            }
            break;

        case InteractObject.ObjectType.Fourche:
            if (character == PnjManager.CharacterType.Paysan)
            {
                returnVal = true;
                EventManager.Instance.UpdateEvent(EventDatabase.EventType.ObjectFourcheToPaysan, 1);
            }
            break;

        case InteractObject.ObjectType.Potion:
            if (character == PnjManager.CharacterType.Pecheur)
            {
                returnVal = true;
                EventManager.Instance.UpdateEvent(EventDatabase.EventType.ObjectPotionToPecheur, 1);
            }
            break;

        default:
            break;
        }
        if (returnVal)
        {
            AkSoundEngine.PostEvent("UI_quest_success", gameObject);
            //PASSE LONOMATOPE EN QUEST
            AkSoundEngine.SetSwitch("NPC_mood", "Quest_end", gameObject);
            isQuestOnomatope = true;
        }
        else
        {
            isQuestOnomatope = false;
        }
        return(returnVal);
    }
Ejemplo n.º 24
0
 private void SwitchToBoy()
 {
     AkSoundEngine.SetSwitch("Dash", "Guy", gameObject);
     AkSoundEngine.SetSwitch("Jump", "Guy", gameObject);
     characterRenderer.material = blueMat;
     girlHair.SetActive(false);
     boyHair.SetActive(true);
 }
 private void OnTriggerEnter(Collider otherGameObject)
 {
     groundType.groundSwitchValue = groundType.GetGroundSwitchValue();
     if (otherGameObject.gameObject.tag == "Player")
     {
         AkSoundEngine.SetSwitch("Forgotten_Sun", groundType.groundSwitchValue.ToString(), otherGameObject.gameObject);       // PARAMS: SetSwitch(<SoundBank To Use>, <Name Of Sound>, <The Game Object to produce the sound>)
     }
 }
Ejemplo n.º 26
0
 private void SwitchToGirl()
 {
     AkSoundEngine.SetSwitch("Dash", "Girl", gameObject);
     AkSoundEngine.SetSwitch("Jump", "Girl", gameObject);
     characterRenderer.material = redMat;
     boyHair.SetActive(false);
     girlHair.SetActive(true);
 }
Ejemplo n.º 27
0
        protected override void DoEffect(PlayerController user)
        {
            GameObject obj = UnityEngine.Object.Instantiate(Fireworks.fireworkObj, user.sprite.WorldCenter, Quaternion.identity);

            AkSoundEngine.SetSwitch("WPN_Guns", Toolbox.GetGunById(39).gunSwitchGroup, base.gameObject);
            AkSoundEngine.PostEvent("Play_WPN_gun_shot_01", base.gameObject);
            obj.AddComponent <SpeedUpBehavior>().owner = user;
        }
 private void OnCollisionEnter(Collision collision)
 {
     if (_SurfaceSwitches.Contains(collision.gameObject.tag))
     {
         AkSoundEngine.SetSwitch("Footstep_Surfaces", collision.gameObject.tag, this.gameObject);
         // Debug.Log($"{this.ToString()} | Footstep_Surfaces = {collision.gameObject.tag}");
     }
 }
Ejemplo n.º 29
0
 public void SetValue(GameObject gameObject)
 {
     if (IsValid())
     {
         AKRESULT result = AkSoundEngine.SetSwitch(GetGroupID(), GetID(), gameObject);
         Verify(result);
     }
 }
Ejemplo n.º 30
0
 public void SetValue(UnityEngine.GameObject gameObject)
 {
     if (IsValid())
     {
         var result = AkSoundEngine.SetSwitch(GetGroupID(), GetID(), gameObject);
         Verify(result);
     }
 }