public override void RaiseEventTileSwitchAnimBegan(Match3Tile neighborTile) { base.RaiseEventTileSwitchAnimBegan(neighborTile); if (neighborTile is BombTile) { BombTile neighborBomb = neighborTile as BombTile; // Mark this tile and it's neighbor as moving and without any gravity because there will be a custom animation on them // to try and keep things consistent. neighborBomb.DisableTileLogic(); DisableTileLogic(); // Prepare the bigger directional destroy effect on this directional tile. prefabTilesDestroyEffect = prefabBombCombineDestroyEffect; } if (neighborTile is DirectionalDestroyTile) { DirectionalDestroyTile directionalTile = neighborTile as DirectionalDestroyTile; directionalTile.SwitchBackOnMatchFail = false; SwitchBackOnMatchFail = false; CanBeMatched = false; (neighborTile as NormalTile).CanBeMatched = false; } }
public void OnTileTapped(AbstractTile tile) { BoardCoord targetCoord = tile.BoardPiece.BoardPosition; if (selectedTile == typeof(BombTile)) { GameObject.Destroy(tile.gameObject); BombTile newTile = Match3BoardRenderer.Instance.SpawnSpecificTileAt(targetCoord, selectedTile, TileColorType.None) as BombTile; newTile.TileColor = RuleEntry.genericColors[Random.Range(0, Match3BoardRenderer.maxNumBoardColors)]; newTile.UpdateMaterial(); } else if (selectedTile == typeof(DirectionalDestroyTile)) { GameObject.Destroy(tile.gameObject); DirectionalDestroyTile newTile = null; if (Random.value > 0.5f) { newTile = Match3BoardRenderer.Instance.SpawnSpecificTileAt(targetCoord, typeof(RowDestroyTile), TileColorType.None) as DirectionalDestroyTile; } else { newTile = Match3BoardRenderer.Instance.SpawnSpecificTileAt(targetCoord, typeof(ColumnDestroyTile), TileColorType.None) as DirectionalDestroyTile; } newTile.TileColor = RuleEntry.genericColors[Random.Range(0, Match3BoardRenderer.maxNumBoardColors)]; newTile.UpdateMaterial(); } else if (selectedTile == typeof(ColorBombTile)) { GameObject.Destroy(tile.gameObject); ColorBombTile newTile = Match3BoardRenderer.Instance.SpawnSpecificTileAt(targetCoord, selectedTile, TileColorType.None) as ColorBombTile; } }
public void Launch(DirectionalDestroyTile sender, float percent, float durationPercent, float totalLineSize) { triggerTransform.localScale = new Vector3((0.75f + numTileLayersAffected) * Match3BoardRenderer.horizTileDistance, 1f, 0f); particleSystem.startLifetime *= percent; StartCoroutine(ScaleFreezeTrigger()); StartCoroutine(StopParticles(particleSystem.duration * durationPercent)); gameObject.SetActive(true); }
public void OnDirectionalBombCombineSndEvent(DirectionalDestroyTile directionalTile) { // sndDirectionalBombCombine.Play(); SoundManager.Instance.PlayOneShot(sndDirectionalBombCombine); }
public void OnDirectionalTileCreatedSndEvent(DirectionalDestroyTile directionalTile) { // sndDirectionalCreate.Play(); SoundManager.Instance.PlayOneShot(sndDirectionalCreate); }
public void OnStartDirectionalTileSndEvent(DirectionalDestroyTile directionalDestroyTile) { sndDirectionalTileActivate.PlayQueued(); }
/// <summary> /// Spawns the new tile. /// </summary> /// <param name='targetPiece'> /// Target piece. /// </param> public Match3Tile SpawnNewTile(bool isBoardSetup = false) { Match3Tile tileResult = null; // Early out if rule if (ruleEntries == null || ruleEntries.Count == 0) { return(tileResult); } if (numberOfExecutions == 0) { EndSpawnRule(); return(tileResult); } //Select random rule entry and acquire its info spawnedEntry = ruleEntries[Random.Range(0, ruleEntries.Count)]; spawnedType = spawnedEntry.RuleTileType; spawnedColor = spawnedEntry.RuleTileColor; if (ownerList != null && ownerList.Count > 0) { numberOfExecutions--; } // bool offBoard = false; // // if(ownerList != null) // { // if (ownerList.Count == 0) // { // offBoard = false; // } // else // { // offBoard = true; // numberOfExecutions--; // } // } //Spawn tile as described by the spawn rule // Debug.LogWarning("[SpawnRule] Spawning [" + spawnedType.ToString() + "] [" + spawnedColor.ToString() + "] [offboard:" + offBoard + "]"); if (typeof(BombTile) == spawnedType) { BombTile spawnedTile = Match3BoardRenderer.Instance.SpawnSpecificTile(spawnedType, TileColorType.None, isBoardSetup) as BombTile; // BombTile spawnedTile = Match3BoardRenderer.Instance.SpawnSpecificTileAt(targetPiece.BoardPosition, spawnedType, TileColorType.None, offBoard, isBoardSetup) as BombTile; spawnedTile.TileColor = spawnedColor; spawnedTile.UpdateMaterial(); tileResult = spawnedTile; } else if (typeof(DirectionalDestroyTile).IsAssignableFrom(spawnedType)) { DirectionalDestroyTile spawnedTile = Match3BoardRenderer.Instance.SpawnSpecificTile(spawnedType, TileColorType.None, isBoardSetup) as DirectionalDestroyTile; // DirectionalDestroyTile spawnedTile = Match3BoardRenderer.Instance.SpawnSpecificTileAt(targetPiece.BoardPosition, spawnedType, TileColorType.None, offBoard, isBoardSetup) as DirectionalDestroyTile; spawnedTile.TileColor = spawnedColor; spawnedTile.UpdateMaterial(); tileResult = spawnedTile; } else { // tileResult = Match3BoardRenderer.Instance.SpawnSpecificTileAt(targetPiece.BoardPosition, spawnedType, spawnedColor, offBoard, isBoardSetup); tileResult = Match3BoardRenderer.Instance.SpawnSpecificTile(spawnedType, spawnedColor, isBoardSetup); } if (tileResult != null) { tileResult.IsTileIgnoredByAntiMatchSystems = isTileIgnoredByAntiMatchSystems; } return(tileResult); }