private IEnumerator ActivatePuzzlePuzzle(GameEntity entity) { WaitHelper.Increase(WaitType.Input, WaitType.Fall, WaitType.Turn, WaitType.CriticalAnimation); yield return(DoWait.WaitWhile(() => entity.isCreatedFromMatch)); var width = _contexts.game.board.Size.x; var height = _contexts.game.board.Size.y; var pos = entity.gridPosition.value; var removerId = IdHelper.GetNewRemoverId(); var radius = 0; var radiusLimit = (int)Mathf.Sqrt(width * width + height * height) + 1; var visited = new bool[width, height]; while (radius < radiusLimit) { ProcessPuzzlePuzzle(pos, radius, removerId, visited); radius++; yield return(DoWait.WaitSeconds(0.07f)); } entity.isWillBeDestroyed = true; WaitHelper.Reduce(WaitType.Input, WaitType.Fall, WaitType.Turn, WaitType.CriticalAnimation); }
private IEnumerator ActivatePositiveItemsSequentially(List <int> ids) { //activate positive items sequentially foreach (var id in ids) { if (Contexts.sharedInstance.game.GetEntityWithId(id) == null) { continue; } yield return(DoWait.WaitSeconds(0.08f)); var posItem = Contexts.sharedInstance.game.GetEntityWithId(id); if (posItem == null) { continue; } var cellItem = _contexts.game.GetEntityWithCellItemId( new Tuple <int, int>(posItem.gridPosition.value.x, posItem.gridPosition.value.y)); if (cellItem != null && cellItem.isCanBeActivatedByInnerMatch) { cellItem.isWillBeDestroyed = true; } ActivatorHelper.ActivateItem(posItem, ActivationReason.Tnt); } }
public void OnMergeTo(GameEntity entity, AxialCoord spot, Action callback) { var movement = transform.DOMove(HexHelperService.HexToPoint(spot), MergeDuration); DoWait.WaitSeconds(0.05f, () => CreateBubbleParticle(transform.position, spriteRenderer.color, mergeParticle)); var seq = DOTween.Sequence(); seq.AppendInterval(0.05f); seq.Append(movement); seq.onComplete += () => callback(); }
public void OnExploded(GameEntity entity, Action callback, bool isMaster) { if (!isMaster) { DoWait.WaitSeconds(0.05f, () => { CreateBubbleParticle(transform.position, spriteRenderer.color, dropParticle); callback(); }); return; } DoWait.WaitSeconds(0.05f, () => { CreateBubbleParticle(transform.position, spriteRenderer.color, explodeParticle); callback(); }); }
private void RemoveCreatedFromMatch(GameEntity entity) { DoWait.WaitSeconds(0.35f, () => entity.isCreatedFromMatch = false); }