// Update is called once per frame void Update() { Vector2 pos = fmvman.ScreenToVideo(Input.mousePosition);//Camera.main.ScreenToViewportPoint(Input.mousePosition); PuzzlePoint pp = GetPuzzlePoint(pos); int puzzle_videos = fmvman.CountPlayingVideos("puzzle"); //if (puzzle_videos > 0) Debug.Log("puzzle_videos == "+puzzle_videos.ToString()); if (puzzle_videos > 0) { pp = null; } if (pp != null) { SetCursor(fmvman.blueeye); } else { SetCursor(fmvman.handwag); } if (Input.GetMouseButtonDown(0)) { //Debug.Log("clicked at "+pos.ToString("0.00")); if (pp != null) { OnClick(pos, pp); } } }
void ClickPoint(PuzzlePoint pp) { if (pp == null) { return; } int slot = System.Int32.Parse(pp.name); Vector2Int coords = GetCoords(slot); if (IsLegal(coords)) { int type = GetSliceType(coords.x, coords.y); types_selected[type]++; num_selected++; SetSlice(slot, selected); //fmvman.ClearPlayingVideos("cake-"+slot.ToString("00")); QueueOverlay(myvidpath + slot.ToString("00") + "df.avi", CakeUp, new Color(0, 0, 251.0f / 255.0f, 1), "select-cake-" + slot.ToString("00"), false, false, GetZ(slot), 0.5f, 0.5f); fmvman.playlist.Add(new FMVManager.Command { type = FMVManager.CommandType.WAITTIME, countdown = 0.1f }); fmvman.playlist.Add(new FMVManager.Command { type = FMVManager.CommandType.CLEARVIDEOS, tags = "start-cake-" + slot.ToString("00") }); //1st selection, Ego says "2 skulls, and 2 stones, the rest is just icing" //2nd selection, Ego says "puzzling" //3rd, Ego says "some cannot be created more equally than others" } //Debug.Log("clicked " + slot.ToString("00")+", ("+coords.ToString()+")"); }
protected void OnClick(Vector2 pos, PuzzlePoint pp) { Debug.Log("clicked " + pp.name + ", at " + pos.ToString("0.00")); if (pp.callback != null) { pp.callback(pp); } }
private void WordCopyToBoard(string word, PuzzleBoard board, PuzzlePoint directionOffsets, int x, int y) { for (int position = 0; position < word.Length; position++) { var thisChar = word[position].ToString(); var currX = x + (position * directionOffsets.X); var currY = y + (position * directionOffsets.Y); board.Letters[currY, currX] = thisChar; } }
private bool WordWillFit(WordSolution solution, PuzzleBoard board, PuzzlePoint directionOffsets, int x, int y) { var rc = true; // We may be finding another placement ... solution.Points.Clear(); for (int position = 0; position < solution.Word.Length; position++) { var thisChar = solution.Word[position].ToString(); var currX = x + (position * directionOffsets.X); var currY = y + (position * directionOffsets.Y); if (currX < 0 || currX > (board.Width - 1) || currY < 0 || currY > (board.Height - 1)) { rc = false; break; // outside the bounds of the grid } // First chance - target cell is empty; Second chance - target cell contains the letter if (board.Letters[currY, currX] != null && board.Letters[currY, currX] != thisChar) { rc = false; break; // won't fit } // Looks like it will fit so far - add Point ... solution.Points.Add(new PuzzlePoint(currX, currY)); } // Verify there is no overlay inside another word placement if (rc) { rc = !board.Solutions.Any( s => s != null && solution.Word.Length <= s.Word.Length && solution.Points.Intersect(s.Points).SequenceEqual(solution.Points) ); } return(rc); }
void ClickPoint(PuzzlePoint pp) { if (pp == null) { return; } int spot = SpotNameToInt(pp.name); if (spiderSpots[spot]) { Debug.Log("spot already filled"); return; } if (currSpider == -1) { if (spiderSpots[(spot + 3) % 8] && spiderSpots[(spot + 5) % 8]) { Debug.Log("spot invalid"); return; } if (fmvman.playing_audio.Count == 0) { PlaySound(whichway); } QueueOverlay(myvidpath + "oy_sp" + pp.name + ".avi", null, new Color(0, 0, 0, 1), "spider-" + pp.name, wait: true, threshold: 0.151f, slope: 0.46f); currSpider = spot; } else { //skipping 3s and skipping 5s, perhaps that's how one derives the spiders for this starry tale if (spot == (currSpider + 3) % 8 || spot == (currSpider + 5) % 8) { spiderSpots[spot] = true; int spidersCount = 0; foreach (var s in spiderSpots) { if (s) { spidersCount++; } } System.Action <FMVManager.Command> callback = SpiderArrived; if (spidersCount == 7) { callback = SpiderArrivedWin; } fmvman.ClearPlayingVideos("spider-" + IntToSpotName(currSpider)); QueueOverlay(myvidpath + "_" + IntToSpotName(currSpider) + "_" + pp.name + ".avi", callback, new Color(0, 0, 0, 1), wait: true, threshold: 0.151f, slope: 0.46f); if (spidersCount == 2) { PlaySound("GAMWAV/2_s_3.avi"); } if (spidersCount == 4) { PlaySound("GAMWAV/2_e_4.avi"); } if (spidersCount == 6) { PlaySound("GAMWAV/2_e_3.avi"); } currSpider = -1; } } }