protected override void Execute(List <GameEntity> entities) { _contexts.game.isBubbleShiftDirty = false; var indented = _contexts.game.boardOffset.Indented; _contexts.game.ReplaceBoardOffset(!indented); var hexMap = HexStorageService.UpdateHexMap(); foreach (var bubble in hexMap) { if (bubble == null) { continue; } var bubblePos = bubble.position.Value; bubble.ReplaceAxialCoord(HexHelperService.PointToHex(bubblePos)); bubble.RemovePosition(); } hexMap = HexStorageService.UpdateHexMap(); var boardSize = _contexts.game.boardSize.Value; var width = boardSize.x; var height = boardSize.y; var r = height - 1; RemoveRow(r, width, hexMap); RemoveRow(r - 1, width, hexMap); FillRow(r - 2, width, hexMap); FillRow(r - 3, width, hexMap); }
private void UpdateGhostBubble(bool valid, Vector3 endPoint) { var ghostBubble = _contexts.game.GetGroup(GameMatcher.Ghost).GetSingleEntity(); if (ghostBubble == null) { ghostBubble = BubbleCreatorService.CreateGhostBubble(new AxialCoord { Q = 0, R = 0 }); } if (!valid) { ghostBubble.isDestroyed = true; return; } var hex = HexHelperService.PointToHex(endPoint); var neighbourAxialCoord = HexHelperService.FindNearestNeighbour(hex, endPoint); if (ghostBubble.axialCoord.Value.Q != hex.Q || ghostBubble.axialCoord.Value.R != hex.R) { ghostBubble.ReplaceAxialCoord(neighbourAxialCoord); } }