예제 #1
0
	protected override void Awake() 
	{
		base.Awake();
		
		string key = "Level" + Match3BoardRenderer.levelIdx + "Time";
		if (TweaksSystem.Instance.floatValues.ContainsKey(key)) {
			startTime = TweaksSystem.Instance.floatValues[key];
		}
		RemainingTime = startTime;

		// Cache the timer sound effect
		sndCountdown = SoundManager.Instance["timer_sfx"];

		LoseTimer.OnRemainingTimeChanged += OnRemainingTimeChangedEvent;
	}
예제 #2
0
	void Awake() 
	{
		instance = this;
		
		soundsDictionary = new Dictionary<string, SoundEffectController>();
		
		// Process the sounds list specified in edit mode and create the corresponding sound dictionary.
		for(int i = 0; i < registeredSoundsList.Count; i++) {
			AddSound(registeredSoundsList[i], true);
		}
		
		// Create and cache the shared sound effect used internally for all OneShot sound effects.
		AddSound(new SoundEffect(null, internalSharedSndId), true);
		sharedSndEffect = this[internalSharedSndId];
	}
	public InGameSoundEventsHandler() 
	{
		// Cache sounds references
		sndMatchCombos = new SoundEffectController[matchComboSndIds.Length];	
		for(int i = 0; i < matchComboSndIds.Length; i++) {
 			sndMatchCombos[i] = SoundManager.Instance[matchComboSndIds[i]];
		}
		
		sndAchieveStars = new SoundEffectController[achieveStarsIds.Length];
		for(int i = 0; i < achieveStarsIds.Length; i++) {
			sndAchieveStars[i] = SoundManager.Instance[achieveStarsIds[i]];
		}

		sndTileSwap = SoundManager.Instance["swap_sfx"];
		sndTileSwapBad = SoundManager.Instance["swap_bad_sfx"];
		sndTileDropImpact = SoundManager.Instance["fall_impact_sfx_01"];
		sndTileMatch = SoundManager.Instance["match_sfx"];
		sndTileDestroy = SoundManager.Instance["tile_destroy_sfx"];
			
		sndDirectionalTileActivate = SoundManager.Instance["winterchill_sfx"];
		sndDirectionalCreate = SoundManager.Instance["winter_create_sfx"];
		sndDirectionalDirectionalCombine = SoundManager.Instance["winterchill_winterchill_sfx"];
		sndDirectionalBombCombine = SoundManager.Instance["winterchill_iceberg_sfx"];
		
		sndBombCreate = SoundManager.Instance["iceberg_create_sfx"];
		sndTriggerBombTileFreeze = SoundManager.Instance["iceberg_freeze_sfx"];
		sndTriggerBombTileDestroy = SoundManager.Instance["iceberg_destroy_sfx"];
		sndBombBombCombine = SoundManager.Instance["iceberg_iceberg_sfx"];
		
		sndColorBombCreate = SoundManager.Instance["glacier_create_sfx"];
		sndTriggerColorBomb = SoundManager.Instance["glacier_sfx"];
		sndColorBombDirectionalCombine = SoundManager.Instance["winterchill_glacier_sfx"];
		sndBombColorBombCombine = SoundManager.Instance["glacier_iceberg_sfx"];
		sndColorBombColorBombCombine = SoundManager.Instance["glacier_glacier_sfx"];
		
		sndSnowTileLayerDestroy = SoundManager.Instance["snow_sfx"];
		
		sndFrostPieceLayerDestroy = SoundManager.Instance["frost_sfx"];
		
		sndLockedTileDestroy = SoundManager.Instance["locked_sfx"];
		
		sndDropTileExit = SoundManager.Instance["drop_sfx"];
		
		sndFreezerTileCreated = SoundManager.Instance["freezer_create"];
	}
    void Start()
    {
        //FOR SCREEN SHOOTING !
        //PlayerPrefs.SetInt("Coins", 1000000);



        Application.targetFrameRate = 60;

        mode = "Main";
        zoom = "mainMenu";

        // Locate sound manager
        GameObject soundManager = GameObject.Find("SoundManager");

        soundEffectController = (SoundEffectController)soundManager.GetComponent(typeof(SoundEffectController));

        // Update the music & sound according to the PlayerPrefs
        UpdateMusicToggle();
        UpdateSoundToggle();

        // Play sound effect
        soundEffectController.playStartEngine();

        //Game center set up
        KTGameCenter.SharedCenter().Authenticate();


        //If its player first time playing, show tutorial.
        int showedTutorial = PlayerPrefs.GetInt("tutorial", 0);

        //If tutorial not opened before.
        if (showedTutorial == 0)
        {
            //open tutorial
            openTutorialScreen();
        }
    }
예제 #5
0
    public bool AddSound(SoundEffect soundEffect, bool checkForDuplicate = false)
    {
        if (checkForDuplicate)
        {
            if (soundsDictionary.ContainsKey(soundEffect.id))
            {
                // The given sound effect has an id already registered in the sound manager.
                return(false);
            }
        }

        SoundEffectController sndController = gameObject.AddComponent <SoundEffectController>();

        soundEffect.ResetDefaults();
        sndController.InitComponent(soundEffect);

        soundsDictionary.Add(sndController.Id, sndController);

        numAllocatedAudioSources += soundEffect.maxAudioSources;

        // Succesfully created and registered the given sound effect.
        return(true);
    }
예제 #6
0
 public void PlayOneShot(SoundEffectController soundEffect, float volumeScale)
 {
     PlayOneShot(soundEffect.SoundClip, volumeScale);
 }
예제 #7
0
 public void PlayOneShot(SoundEffectController soundEffect)
 {
     PlayOneShot(soundEffect.SoundClip, soundEffect.sound.volume);
 }
예제 #8
0
 // Use this for initialization
 void Awake()
 {
     Instance = this;
 }
예제 #9
0
    IEnumerator FreeFall()
    {
        freeFalling = true;

        yield return(StartCoroutine(DestroyAllTriggerTiles()));

        LoseMoves loseConditionMoves = loseConditions as LoseMoves;

        if (loseConditionMoves == null || loseConditionMoves.RemainingMoves == 0)
        {
            OnStableBoard += FreeFallFinished;
            IsBoardStable  = false;
            TryCheckStableBoard();
            yield break;
        }

        List <Match3BoardPiece> allNormalBoardPieces = new List <Match3BoardPiece>();
        SoundEffectController   sndDirectionalCreate = SoundManager.Instance["winter_create_sfx"];

        float waitTime = 0.5f;

        while (loseConditionMoves.RemainingMoves > 0)
        {
            if (callFreeFallEvent)
            {
                callFreeFallEvent = false;
                OnFreeFall.RaiseEvent();

                yield return(new WaitForSeconds(1.5f));
            }

            yield return(new WaitForSeconds(waitTime));

            waitTime = Mathf.Clamp(waitTime - 0.03f, 0.03f, 0.5f);

            allNormalBoardPieces.Clear();

            boardData.ApplyActionToAll((boardPiece) => {
                Match3Tile tile = boardPiece.Tile as Match3Tile;
                if (tile != null && !tile.IsMoving && tile.IsDestructible && !tile.IsDestroying && tile.GetType() == typeof(NormalTile))
                {
                    allNormalBoardPieces.Add(boardPiece as Match3BoardPiece);
                }
            });

            loseConditions.NewMove();
            loseConditionMoves.RemainingMoves--;             //because the lose condition is paused at this time

            if (allNormalBoardPieces.Count <= 0)
            {
                continue;
            }

            int index = Random.Range(0, allNormalBoardPieces.Count);
            Match3BoardPiece chosenPiece = allNormalBoardPieces[index];
            Match3Tile       chosenTile  = chosenPiece.Tile as Match3Tile;
            allNormalBoardPieces.RemoveAt(index);

            chosenPiece.Tile = (boardRenderer as Match3BoardRenderer).SpawnSpecificTileAt(chosenPiece.BoardPosition.row,
                                                                                          chosenPiece.BoardPosition.col, (Random.Range(0, 2) == 0) ? typeof(RowDestroyTile) : typeof(ColumnDestroyTile), TileColorType.None);
            (chosenPiece.Tile as Match3Tile).TileColor = chosenTile.TileColor;
            (chosenPiece.Tile as DirectionalDestroyTile).UpdateMaterial();
            Destroy(chosenTile.gameObject);
            ScoreSystem.Instance.AddScore(TweaksSystem.Instance.intValues["MovesScoreMultiplier"], false);

            SoundManager.Instance.PlayOneShot(sndDirectionalCreate);

            if (loseConditionMoves.RemainingMoves == 0)
            {
                break;
            }

            TryCheckStableBoard();
        }

        yield return(new WaitForSeconds(1f));

        yield return(StartCoroutine(DestroyAllTriggerTiles()));

        OnStableBoard += FreeFallFinished;
        IsBoardStable  = false;
        TryCheckStableBoard();
    }
예제 #10
0
	public void PlayOneShot(SoundEffectController soundEffect) 
	{
		PlayOneShot(soundEffect.SoundClip, soundEffect.sound.volume);
	}
예제 #11
0
	public void PlayOneShot(SoundEffectController soundEffect, float volumeScale)
	{
		PlayOneShot(soundEffect.SoundClip, volumeScale);
	}
예제 #12
0
 private void Awake()
 {
     control = this;
 }
예제 #13
0
 protected override void Awake()
 {
     base.Awake();
     instance = GetComponent <SoundEffectController> ();
 }
예제 #14
0
 // Use this for initialization
 void Start()
 {
     musicController = GameObject.Find("MusicPlayer").GetComponent <MusicController> ();
     sfxController   = GameObject.Find("SoundEffectController").GetComponent <SoundEffectController> ();
     MaybeInitializeSettings();
 }
예제 #15
0
 private void PlayProductSoldSound(Product product)
 {
     // @TODO: Implement unique sound fx
     SoundEffectController.PlayEffect(EffectType.ItemSold);
 }
예제 #16
0
    private void OnExitArrive()
    {
        m_ClientSpawnSystem.DespawnClient(this.gameObject);

        SoundEffectController.PlayEffect(EffectType.ClientLeave);
    }