Example #1
0
	public void RaiseOnFreezerTileCreateEvent(FreezerTile target)
	{
		if(OnFreezerTileCreated != null)
		{
			OnFreezerTileCreated(target);
		}
	}
Example #2
0
	public void RaiseOnFreezerTileDestroyedEvent(FreezerTile target)
	{
		if(OnFreezerTileDestroyed != null)
		{
			OnFreezerTileDestroyed(target);
		}
	}
 public void RaiseOnFreezerTileDestroyedEvent(FreezerTile target)
 {
     if (OnFreezerTileDestroyed != null)
     {
         OnFreezerTileDestroyed(target);
     }
 }
 public void RaiseOnFreezerTileCreateEvent(FreezerTile target)
 {
     if (OnFreezerTileCreated != null)
     {
         OnFreezerTileCreated(target);
     }
 }
    public void Replicate()
    {
        int randomIndex        = Random.Range(0, validReplicationList.Count);
        int randomIndexSpecial = Random.Range(0, validReplicationListSpecial.Count);
        Match3BoardPiece targetBoardPiece;

        if (validReplicationList.Count != 0)
        {
            targetBoardPiece = freezerNeighbors[validReplicationList[randomIndex]];
        }
        else
        {
            targetBoardPiece = freezerNeighbors[validReplicationListSpecial[randomIndexSpecial]];
        }

        NormalTile oldTile = targetBoardPiece.Tile as NormalTile;

        //Create new freezer tile
        Match3BoardRenderer.Instance.SpawnSpecificTileAt(targetBoardPiece.BoardPosition, typeof(FreezerTile), TileColorType.None, false);
        FreezerTile newFreezerTile = (targetBoardPiece.Tile as FreezerTile);

        //Raise CREATE event
        RaiseOnFreezerTileCreateEvent(newFreezerTile);

        newFreezerTile.StartCoroutine(newFreezerTile.PlayCreateAnimation());

        if (oldTile != null)
        {
            oldTile.DisableTileLogic();
            GameObject.Destroy(oldTile.gameObject);
        }

        Match3BoardGameLogic.Instance.IsBoardStable = false;
        Match3BoardGameLogic.Instance.TryCheckStableBoard();
    }
Example #6
0
    protected IEnumerator OnStableBoardCoroutine()
    {
        yield return(new WaitForEndOfFrame());

        while (BoardShuffleController.Instance.IsBoardReshuffling)
        {
            yield return(null);
        }

        int         index             = Random.Range(0, allFreezers.Count);
        int         count             = 0;
        FreezerTile previousCandidate = null;

        if (freezerDestroyedThisTurn || Match3BoardGameLogic.Instance.IsGameOver)
        {
            freezerDestroyedThisTurn = false;
            yield break;
        }

        while (count < allFreezers.Count)
        {
//				Debug.LogWarning("Trying out index: " + index + "out of " + allFreezers.Count);
            allFreezers[index].RefreshValidIndexList();
//				Debug.LogWarning("Count: " + allFreezers[index].validReplicationList.Count);

            if (allFreezers[index].validReplicationList.Count != 0)
            {
                allFreezers[index].Replicate();
                yield break;
            }
            else
            {
                if (allFreezers[index].validReplicationListSpecial.Count != 0)
                {
                    previousCandidate = allFreezers[index];
                }
                index++;
                index = index % allFreezers.Count;
                count++;
            }
        }

        if (previousCandidate != null)
        {
            previousCandidate.Replicate();
        }
    }
	public void OnFreezerTileDestroyed(FreezerTile freezerTile)
	{
		sndSnowTileLayerDestroy.PlayQueued();
	}
	public void OnFreezerTileCreated(FreezerTile freezerTile)
	{
		SoundManager.Instance.PlayOneShot(sndFreezerTileCreated);
	}
Example #9
0
 public void OnFreezerTileDestroyed(FreezerTile freezerTile)
 {
     sndSnowTileLayerDestroy.PlayQueued();
 }
Example #10
0
 public void OnFreezerTileCreated(FreezerTile freezerTile)
 {
     SoundManager.Instance.PlayOneShot(sndFreezerTileCreated);
 }