protected override void Execute(List <GameEntity> entities) { foreach (var tntTnt in entities) { tntTnt.isSpawnAnimationStarted = false; tntTnt.isSpawnAnimationEnded = false; var pos = tntTnt.gridPosition.value; var radius = tntTnt.tntTnt.Radius; var removerId = IdHelper.GetNewRemoverId(); for (int x = pos.x - radius; x <= pos.x + radius; x++) { for (int y = pos.y - radius; y <= pos.y + radius; y++) { CellHelper.UnBlockFallAt(new Vector2Int(x, y)); ActivatorHelper.TryActivateItemWithPositive(new Vector2Int(x, y), removerId, ActivationReason.Tnt); } } tntTnt.isWillBeDestroyed = true; WaitHelper.Reduce(WaitType.Input, WaitType.Turn, WaitType.CriticalAnimation); } }
private void ProcessGodTouch(Vector2Int touchPos, int removerId) { var item = _contexts.game.GetItemWithPosition(touchPos); if (item == null || item.hasFalling) { return; } ActivatorHelper.TryActivateItemWithPositive(touchPos, removerId, ActivationReason.God); }
private void ActivateBlockWithPuzzlePuzzle(int x, int y, int removerId, bool[,] visited) { if (visited[x, y]) { return; } visited[x, y] = true; ActivatorHelper.TryActivateItemWithPositive(new Vector2Int(x, y), removerId, ActivationReason.PuzzlePuzzle); }
private void ProcessActiveRotor(GameEntity entity, Vector2 rotorPos, ActiveRotor activeRotor, int removerId) { int x = 0; int y = 0; switch (activeRotor.Direction) { case RotorDirection.Down: x = (int)(rotorPos.x); y = (int)(rotorPos.y + 0.1f); break; case RotorDirection.Up: x = (int)(rotorPos.x); y = (int)(rotorPos.y + 1 - 0.1f); break; case RotorDirection.Left: x = (int)(rotorPos.x + 0.1f); y = (int)(rotorPos.y); break; case RotorDirection.Right: x = (int)(rotorPos.x + 1 - 0.1f); y = (int)(rotorPos.y); break; } if (!InBounds(x, y)) { return; } var pos = new Vector2Int(x, y); if (pos.Equals(activeRotor.LastPassedCell)) { return; } entity.ReplaceActiveRotor(activeRotor.Direction, pos); ActivatorHelper.TryActivateItemWithPositive(pos, removerId, ActivationReason.Rotor); }