Esempio n. 1
0
    public void InitNativeAudio()
    {
        AndroidNativeAudio.makePool(16);

        buttonSoundID = AndroidNativeAudio.load("Android Native Audio/button.ogg");
        coinSoundID   = AndroidNativeAudio.load("Android Native Audio/coin.mp3");
    }
    void Awake()
    {
        instance = this;
        AndroidNativeAudio.makePool();
        //for (int i = 0; i < musicClips.Length; i++)
        //{
        //    musicClipDictionary.Add(musicClips[i].name, musicClips[i]);
        //}
#if UNITY_EDITOR || UNITY_STANDALONE
        for (int i = 0; i < musicNames.Length; i++)
        {
            StartCoroutine(LoadClipCoroutine("Music", musicNames[i], AudioType.OGGVORBIS, OnMusicLoadingCompleted));
        }
        for (int i = 0; i < SFXNames.Length; i++)
        {
            StartCoroutine(LoadClipCoroutine("SFX", SFXNames[i], AudioType.WAV, OnSFXLoadingCompleted));
        }
#else
        for (int i = 0; i < SFXNames.Length; i++)
        {
            SFXFileIDDictionary.Add(SFXNames[i], AndroidNativeAudio.load(string.Format("SFX/{0}.wav", SFXNames[i])));
        }
#endif

        //for (int i = 0; i < musicNames.Length; i++)
        //{
        //    musicFileIDDictionary.Add(musicNames[i], ANAMusic.load(string.Format("Music/{0}.ogg", musicNames[i]), false, false));
        //}
    }
    void Start()
    {
        var genericMenuList = GameObject.FindGameObjectsWithTag("GenericMenu");

        if (genericMenuList.Length > 1)
        {
            foreach (var genericMenuManager in genericMenuList)
            {
                genericMenuManager.GetComponent <GenericMenuManagerBehavior> ().BackSceneName = this.BackSceneName;
            }
            Destroy(gameObject);
            return;
        }

        AndroidNativeAudio.makePool();
        _hasMadeAudioPool = true;

        SceneManager.sceneLoaded += OnSceneLoaded;
        HandleBackButton();

        // ---- AUDIOS ---- //
        MenuBipDefaultAudioFileID = AndroidNativeAudio.load("MenuBipDefault.mp3");
        MenuBipGoToAudioFileID    = AndroidNativeAudio.load("MenuBipGoTo.mp3");
        MenuBipSelectAudioFileID  = AndroidNativeAudio.load("MenuBipSelect.mp3");
        MenuBipConfirmAudioFileID = AndroidNativeAudio.load("MenuBipConfirm.mp3");
        MenuBipReturnAudioFileID  = AndroidNativeAudio.load("MenuBipReturn.mp3");

        SwitchTVONFileID       = AndroidNativeAudio.load("SwitchTVON.mp3");
        NamePresentationFileID = AndroidNativeAudio.load("NamePresentation.mp3");
        BorderMovementFileID   = AndroidNativeAudio.load("BorderMovement.mp3");
    }
Esempio n. 4
0
    public int ANALoadAudio(string audioFile)
    {
        int fileId = AndroidNativeAudio.load(audioFile);

        loadedFiles.Add(fileId);
        return(fileId);
    }
Esempio n. 5
0
    void Start()
    {
        unityAudio = GetComponent <AudioSource>();

        AndroidNativeAudio.makePool(1);
        soundID = AndroidNativeAudio.load("Android Native Audio/Tone Native.wav");
    }
 private void Start()
 {
     AndroidNativeAudio.makePool(); // makes 16 streams by default
     foreach (SoundEffect effect in effects)
     {
         effect.fileID = AndroidNativeAudio.load(effect.filePath);
     }
 }
Esempio n. 7
0
    // Use this for initialization
    void Start()
    {
        player = FindObjectOfType <PlayerController>();
        playerStartingSpeed = player.moveSpeed;
        powerUpActive       = false;

        powerUpFileID = AndroidNativeAudio.load("power-up-sound.mp3");
    }
Esempio n. 8
0
    // Use this for initialization
    void Start()
    {
        scoreManager    = FindObjectOfType <ScoreManager>();
        currencyManager = FindObjectOfType <CurrencyManager>();
        camera          = FindObjectOfType <CameraController>();

        tomatoFileID = AndroidNativeAudio.load("tomato-squish.wav");
    }
Esempio n. 9
0
 // Start is called before the first frame update
 void Start()
 {
     AndroidNativeAudio.makePool();
     BopH = AndroidNativeAudio.load("Sounds/BopH.wav");
     BopM = AndroidNativeAudio.load("Sounds/BopM.wav");
     BopL = AndroidNativeAudio.load("Sounds/BopL.wav");
     GameObject.Find("Sounds").GetComponent <AudioSource>().volume = PlayerPrefs.GetFloat("MusicVol", 1f);
 }
Esempio n. 10
0
        /// <summary>
        /// On Android, we must use soundpool, hence the different call
        /// </summary>
        /// <param name="soundPath"></param>
        /// <returns></returns>
        public int LoadSoundForAndroid(string soundPath)
        {
            if (!isInitialized)
            {
                Initialize();
            }

            return(AndroidNativeAudio.load(soundPath));
        }
Esempio n. 11
0
    public void Start()
    {
        AndroidNativeAudio.makePool();

        foreach (Sound s in sounds)
        {
            s.id = AndroidNativeAudio.load(s.name + ".mp3");
            //Debug.Log("file id = " + s.id);
        }
    }
    // Use this for initialization

    void Start()
    {
        current = this;

        AndroidNativeAudio.makePool(15);
        railSound       = AndroidNativeAudio.load("AntiMaterialRifle_1p_02.wav");
        gunSound        = AndroidNativeAudio.load("AutoGun_1p_02.wav");
        enemyExplosion  = AndroidNativeAudio.load("explosion_enemy.wav");
        playerExplosion = AndroidNativeAudio.load("explosion_player.wav");
    }
Esempio n. 13
0
    // Initialization -----------------------------------------------------------------------------------------------
    void Start()
    {
        width  = (float)Screen.width * 0.5f;
        height = (float)Screen.height * 0.5f;

        SR_background = SR_background1;
        SR_background2.transform.position = new Vector3(0.0f, 0.0f, -1.0f);

        AndroidNativeAudio.makePool(2);
        winSoundId  = AndroidNativeAudio.load("WinSound.wav");
        loseSoundId = AndroidNativeAudio.load("LoseSound.wav");
    }
Esempio n. 14
0
    private void SetAudios()
    {
#if UNITY_EDITOR
        _pcAudioReference = new List <string>();
        _pcAudioReference.Add("ClickIn");
        _pcAudioReference.Add("ClickOut");
#else
        AndroidNativeAudio.makePool();
        ClickIn  = AndroidNativeAudio.load("ClickIn.mp3");
        ClickOut = AndroidNativeAudio.load("ClickOut.mp3");
#endif
    }
Esempio n. 15
0
    void Start()
    {
        // Set up Android Native Audio
        AndroidNativeAudio.makePool();
        FileID = AndroidNativeAudio.load("Android Native Audio/Tone Native.wav");

        // Set up Unity audio for comparison
        UnityAudio = GetComponent <AudioSource>();

        // Set up GUI
        SetupGUI();
    }
Esempio n. 16
0
    // Use this for initialization
    void Start()
    {
        myRigidbody = GetComponent <Rigidbody2D>();
        //myCollider = GetComponent<Collider2D>();
        myAnimator      = GetComponent <Animator>();
        jumpTimeCounter = jumpTime;
        moveSpeed       = 10;

        // Set up Android Native Audio
        AndroidNativeAudio.makePool(3);
        jumpFileID     = AndroidNativeAudio.load("jump.wav");
        gameOverFileID = AndroidNativeAudio.load("game-over-sound.wav");

        stoppedJumping = true;
    }
Esempio n. 17
0
    public void LoadSound()
    {
        //// 사운드 동시 출력 최대 갯수 만큼 AudioSource 생성
        //for (int i = 0; i < soundMaxNum; i++)
        //{
        //    audioSource[i] = this.gameObject.AddComponent<AudioSource>();
        //    audioSource[i].bypassEffects = true;
        //    audioSource[i].bypassListenerEffects = true;
        //    audioSource[i].bypassReverbZones = true;
        //}

        //// 사운드 로드
        //AudioClip[] resourcesAudioClip = Resources.LoadAll<AudioClip>("Sound");
        //for (int i = 0; i < resourcesAudioClip.Length; i++)
        //{
        //    DicAudioClip.Add(resourcesAudioClip[i].name, resourcesAudioClip[i]);
        //}
        //안드로이드 사운드
        // Set up Android Native Audio
        AndroidNativeAudio.makePool(16);

        FileID = new int[System.Enum.GetValues(typeof(eSound)).Length];
        //Debug.Log("System.Enum.GetValues(typeof(eSound)).Length" + System.Enum.GetValues(typeof(eSound)).Length);
        //Debug.Log("FileID.Length" + FileID.Length);

        SoundID = new int[System.Enum.GetValues(typeof(eSound)).Length];


        //Debug.Log("SoundID.Length" + SoundID.Length);

        SoundString = System.Enum.GetNames(typeof(eSound));
        for (int i = 0; i < System.Enum.GetValues(typeof(eSound)).Length; i++)
        {
            //Debug.Log(SoundString[i]);
            if (i == 0)
            {
                MusicID = ANAMusic.load("Sound/" + SoundString[i] + ".ogg", false, true, Loaded);
            }
            else
            {
                FileID[i] = AndroidNativeAudio.load("Sound/" + SoundString[i] + ".wav");
            }

            //Debug.Log(SoundString[i]);

            //SoundID[i] = AndroidNativeAudio.play(FileID[i], 1, -1, 1, 1);
        }
    }
Esempio n. 18
0
    void Start()
    {
        // Set up Android Native Audio
        AndroidNativeAudio.makePool();
        FileID = AndroidNativeAudio.load("Android Native Audio/fall.mp3");
        Debug.Log("id: " + FileID);

        xd = AndroidNativeAudio.load("fall.mp3");
        Debug.Log("id: " + xd);


        // Set up Unity audio for comparison
        UnityAudio = GetComponent <AudioSource>();

        // Set up GUI
        SetupGUI();
    }
Esempio n. 19
0
    void Start()
    {
        iniNoteOrientation = Random.Range(-180f, 180f);

        transform.localScale = new Vector3(4.3f, 4.3f, 1f);

        //try 2 color gradient with a fixed alpha of 1.0f.
        float    alpha    = 1.0f;
        Gradient gradient = new Gradient();

        gradient.SetKeys(
            new GradientColorKey[] { new GradientColorKey(c1, 0.0f), new GradientColorKey(c2, 1.0f) },
            new GradientAlphaKey[] { new GradientAlphaKey(alpha, 0.0f), new GradientAlphaKey(alpha, 1.0f) }
            );

        FileID = AndroidNativeAudio.load("Piano/" + keySound.name + ".wav");
        //FileID = AndroidNativeAudio.load("Piano/" + keySound.name + ".mp3");
    }
Esempio n. 20
0
    public void LoadSounds(string flap, string point, string death, string noBounce)
    {
        var fileID = AndroidNativeAudio.load(flap);

        fileIDs.Add(flap, fileID);

        var fileID2 = AndroidNativeAudio.load(point);

        fileIDs.Add(point, fileID2);

        var fileID3 = AndroidNativeAudio.load(death);

        fileIDs.Add(death, fileID3);

        var fileID4 = AndroidNativeAudio.load(noBounce);

        fileIDs.Add(noBounce, fileID4);
    }
 //edited add whole fuction start
 void Start()
 {
     AndroidNativeAudio.makePool();
     //loading all FileID's
     playBtnFID        = AndroidNativeAudio.load("ev_button_click.mp3");
     knifeHitFID       = AndroidNativeAudio.load("ev_knife_hit_1.mp3");
     throwKnifeFID     = AndroidNativeAudio.load("ev_throw_1.mp3");
     lastHitFID        = AndroidNativeAudio.load("ev_hit_last.mp3");
     woodHitFID        = AndroidNativeAudio.load("ev_hit_1.mp3");
     appleHitFID       = AndroidNativeAudio.load("ev_apple_hit_1.mp3");
     onUnlockFID       = AndroidNativeAudio.load("ev_shop_random_unlock.mp3");
     randomUnlockFID   = AndroidNativeAudio.load("ev_shop_random_beep.mp3");
     confirmKnifeFID   = AndroidNativeAudio.load("ev_shop_select_item_confirm.mp3");
     lockKnifeFID      = AndroidNativeAudio.load("ev_shop_select_locked_item.mp3");
     unlockKnifeFID    = AndroidNativeAudio.load("ev_shop_select_item.mp3");
     bossFightStartFID = AndroidNativeAudio.load("BossFightEndSlam.mp3");
     bossFightEndFID   = AndroidNativeAudio.load("Slam_Slice_Fast_01.mp3");
     freeContinueFID   = AndroidNativeAudio.load("Quick_Impact_01.mp3");
 }
Esempio n. 22
0
    // Initialize Android Native audio with sound effects
    void Start()
    {
        m_isAndroid = (Application.platform == RuntimePlatform.Android);


        AndroidNativeAudio.makePool(2);
        m_winSoundId        = AndroidNativeAudio.load("WinSound.wav");
        m_loseSoundId       = AndroidNativeAudio.load("LoseSound.wav");
        m_navigateSoundId   = AndroidNativeAudio.load("SuccessfulMenuNavigation.wav");
        m_stuckSoundId      = AndroidNativeAudio.load("StuckMenuSound.wav");
        m_winStreamId       = -1;
        m_loseStreamId      = -1;
        m_navigateStreamId  = -1;
        m_stuckStreamId     = -1;
        m_winLevelStreamId  = -1;
        m_loseLevelStreamId = -1;
        m_songTimer         = 0.0f;
        m_resetTimer        = 0.0f;
    }
Esempio n. 23
0
        protected virtual void Start()
        {
            AndroidNativeAudio.makePool();
            foreach (var audioEvent in startAudioEvents)
            {
                if (sortedAudioEvents.ContainsKey(audioEvent.Event))
                {
                    sortedAudioEvents[audioEvent.Event].Add(AndroidNativeAudio.load(audioEvent.Path));
                }
                else
                {
                    sortedAudioEvents.Add(audioEvent.Event, new List <int> {
                        AndroidNativeAudio.load(audioEvent.Path)
                    });
                    eventTimes.Add(audioEvent.Event, new TimedNumber(0f, 0));
                    EventManager.Subscribe(audioEvent.Event, Handler_StartAudioEvent);
                }
            }

            foreach (var stopAudioEvent in stopLoopedAudioEvents)
            {
                EventManager.Subscribe(stopAudioEvent, Handler_StopLoopedEvent);
            }
        }
Esempio n. 24
0
    private void Awake()
    {
        FileID = AndroidNativeAudio.load("Piano/" + keySound.name + ".wav");
        //FileID = AndroidNativeAudio.load("Piano/" + keySound.name + ".mp3");

    }
    // ---- AUDIOS ---- //

    void Start()
    {
        if (IsHowToPlay)
        {
            PlayerPrefs.SetInt("SelectedMap", 1);
        }
        AndroidNativeAudio.makePool();
        if (!IsHowToPlay)
        {
            Destroy(GameObject.FindGameObjectWithTag("MenuBackground"));
        }
        if (PlayerPrefs.GetInt("Music", 1) == 0 && StageMusic != null)
        {
            StageMusic.volume = 0.0f;
        }
        if (StageMusic != null)
        {
            StageMusic.Play();
        }
        ScorePlayerOne         = 0;
        ScorePlayerTwo         = 0;
        SetPlayerOne           = 0;
        SetPlayerTwo           = 0;
        _maxScore              = PlayerPrefs.GetInt("MaxScore");
        _maxSets               = PlayerPrefs.GetInt("MaxSets");
        _playerTwoXAxisUnder20 = 0.78f;
        _playerTwoXAxisOver20  = 1.2f;
        _playerTwoXAxisEquals1 = 0.39f;
        _playerName            = CurrentPlayer.PlayerOne.ToString();

        _scoreP1   = GameObject.Find("ScoreP1");
        _scoreP2   = GameObject.Find("ScoreP2");
        _scoreP1_1 = GameObject.Find("ScoreP1-1");
        _scoreP1_2 = GameObject.Find("ScoreP1-2");
        _scoreP2_1 = GameObject.Find("ScoreP2-1");
        _scoreP2_2 = GameObject.Find("ScoreP2-2");

        _setP1   = GameObject.Find("SetP1");
        _setP2   = GameObject.Find("SetP2");
        _setP1_1 = GameObject.Find("SetP1-1");
        _setP1_2 = GameObject.Find("SetP1-2");
        _setP2_1 = GameObject.Find("SetP2-1");
        _setP2_2 = GameObject.Find("SetP2-2");

        _winner  = GameObject.Find("Winner");
        _loser   = GameObject.Find("Loser");
        _draw01  = GameObject.Find("Draw01");
        _draw02  = GameObject.Find("Draw02");
        _gameEnd = false;

        // ---- AUDIOS ---- //
        CastSPAudioFileID         = AndroidNativeAudio.load("CastSP.mp3");
        CatchAudioFileID          = AndroidNativeAudio.load("Catch.mp3");
        DashAudioFileID           = AndroidNativeAudio.load("Dash.mp3");
        GoalAudioFileID           = AndroidNativeAudio.load("Goal.mp3");
        LiftAudioFileID           = AndroidNativeAudio.load("Lift.mp3");
        QuickEffectAudioFileID    = AndroidNativeAudio.load("QuickEffect.mp3");
        ThrowAudioFileID          = AndroidNativeAudio.load("Throw.mp3");
        WallHitAudioFileID        = AndroidNativeAudio.load("WallHit.mp3");
        MenuBipSelectAudioFileID  = AndroidNativeAudio.load("MenuBipSelect.mp3");
        MenuBipConfirmAudioFileID = AndroidNativeAudio.load("MenuBipConfirm.mp3");
        MenuBipReturnAudioFileID  = AndroidNativeAudio.load("MenuBipReturn.mp3");
        MenuBipGoToAudioFileID    = AndroidNativeAudio.load("MenuBipGoTo.mp3");

        _pointAudioFileID = AndroidNativeAudio.load("Point.mp3");
        _setAudioFileID   = AndroidNativeAudio.load("Set.mp3");
        _slideAudioFileID = AndroidNativeAudio.load("Slide.mp3");
        // ---- AUDIOS ---- //

        //_playerOne = GameObject.Find ("PlayerOne");
        //_playerTwo = GameObject.Find ("PlayerTwo");

        _playerOne = CreateCharacter(CurrentPlayer.PlayerOne, 1);

        if (PlayerPrefs.GetInt("Opponent") != Opponent.Player.GetHashCode())
        {
            DestroyP2Objects();
        }

        if (PlayerPrefs.GetInt("Opponent") == Opponent.Player.GetHashCode() ||
            PlayerPrefs.GetInt("Opponent") == Opponent.AI.GetHashCode())
        {
            _playerTwo = CreateCharacter(CurrentPlayer.PlayerTwo, 2);
        }
        else if (PlayerPrefs.GetInt("Opponent") == Opponent.Wall.GetHashCode())
        {
            CreateWall();
        }
        IsPaused = false;

        if (PlayerPrefs.GetInt("GameInProgress", 0) == 1)
        {
            SetGameInProgressData();
        }

        if (PlayerPrefs.GetInt("GameMode") == GameMode.Duel.GetHashCode() ||
            PlayerPrefs.GetInt("GameMode") == GameMode.Tournament.GetHashCode())
        {
            if (!IsHowToPlay && PlayerPrefs.GetInt("GameInProgress", 0) == 0)
            {
                PlayerPrefs.SetInt("GameInProgress", 1);
                PlaceBall();
            }
        }
        else if (PlayerPrefs.GetInt("GameMode") != GameMode.Tournament.GetHashCode())
        {
            PlayerPrefs.SetInt("GameInProgress", 0);
            if (PlayerPrefs.GetInt("GameMode") == GameMode.Target.GetHashCode())
            {
                NewTarget();
                _challengeScoreCount = -1;
            }
            else if (PlayerPrefs.GetInt("GameMode") == GameMode.Catch.GetHashCode())
            {
                var tmpLauncherModel = Resources.Load <GameObject> ("Prefabs/Launcher");
                _launcher = Instantiate(tmpLauncherModel, new Vector3(-5.0f, tmpLauncherModel.transform.position.y, tmpLauncherModel.transform.position.z), tmpLauncherModel.transform.rotation);
                _launcher.gameObject.name = "Launcher";
                Invoke("NewLaunch", 0.5f);
                GameObject.Find("GoalTop01").tag = "MiddleWall";
                GameObject.Find("GoalTop02").tag = "MiddleWall";
                GameObject.Find("GoalTop03").tag = "MiddleWall";
                _challengeScoreCount             = -1;
            }
            else if (PlayerPrefs.GetInt("GameMode") == GameMode.Breakout.GetHashCode())
            {
                _challengeScoreCount = -1;
                NewBreakout();
                GameObject.Find("GoalTop01").tag = "MiddleWall";
                GameObject.Find("GoalTop02").tag = "MiddleWall";
                var hipoteticThirdWall = GameObject.Find("GoalTop03");
                if (hipoteticThirdWall != null)
                {
                    hipoteticThirdWall.tag = "MiddleWall";
                }
            }
            GameObject.Find("NoPlayerBannerRules").GetComponent <UnityEngine.UI.Text>().text = "Goal :\n" + 0 + "/" + _maxScore.ToString();
            NewBallChallenge();
        }
    }
Esempio n. 26
0
    private IEnumerator LoadSounds()
    {
        yield return(new WaitForSeconds(0.1f));

        var allSounds = ConcatArrays(WelcomeSoundName, ButtonClickSoundName, SceneLoadSoundName, RedPlantedSoundName, BluePlantedSoundName, YellowPlantedSoundName, WinSoundName, LossSoundName, WinMusicName, LossMusicName, CorrectSoundName, IncorrectSoundName, GrowingSoundName, ShakeSoundName);

        State.loadGoals += (float)allSounds.Length;

        Debug.LogWarningFormat("Loading Goal Increased to {0}", State.loadGoals);

        // set all volumes to 0
        float tempVoiceVolume   = VoiceSource.volume;
        float tempButtonVolume  = ButtonSource.volume;
        float tempStingerVolume = StingerSource.volume;

        VoiceSource.volume   = 0;
        ButtonSource.volume  = 0;
        StingerSource.volume = 0;


#if UNITY_ANDROID && !UNITY_EDITOR
        AndroidNativeAudio.setVolume(0, 0f);
        AndroidNativeAudio.setVolume(1, 0f);
        AndroidNativeAudio.setVolume(2, 0f);
#endif

        foreach (string c in allSounds)
        {
            string path = "";


#if UNITY_ANDROID && !UNITY_EDITOR
            int soundID = AndroidNativeAudio.load(c + ".wav");
            //Debug.LogFormat("Loading Sound:SoundID {0}: {1}", c, soundID);
            if (!dictSounds.ContainsKey(c))
            {
                dictSounds.Add(c, soundID);
                //AndroidNativeAudio.play(dictSounds[c]);
                yield return(new WaitForSeconds(0.01f));
            }
#else
            path = "file://" + System.IO.Path.Combine(Application.streamingAssetsPath, c + ".wav");
            //Debug.LogFormat("Loading AudioClip {0}::{1}", c, path);

            using (UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(path, AudioType.WAV))
            {
                yield return(www.SendWebRequest());

                if (www.result == UnityWebRequest.Result.ConnectionError)
                {
                    Debug.Log(www.error);
                }
                else
                {
                    AudioClip myClip = DownloadHandlerAudioClip.GetContent(www);
                    if (!dictClips.ContainsKey(c))
                    {
                        dictClips.Add(c, myClip);
                        yield return(new WaitForSeconds(0.01f));
                    }
                }
            }
#endif

            State.loadGoalsComplete += 1f;
        }

        // set all volumes back to what they were
        VoiceSource.volume   = tempVoiceVolume;
        ButtonSource.volume  = tempButtonVolume;
        StingerSource.volume = tempStingerVolume;

#if UNITY_ANDROID && !UNITY_EDITOR
        AndroidNativeAudio.setVolume(0, maxSoundEffectVolume);
        AndroidNativeAudio.setVolume(1, maxSoundEffectVolume);
        AndroidNativeAudio.setVolume(2, maxSoundEffectVolume);
#endif



        allAudioLoaded = true;
    }