/// <summary>Initializes the SolveResults.</summary> /// <param name="status">The status of the result.</param> /// <param name="state">The puzzle state returned from the solver, a valid solution if status is PuzzleStatus.Solved.</param> /// <param name="numberOfDecisionPoints"> /// The number of decision points involved in finding the solution. This is the number /// of times that the solver had to use brute-force methods to make progress. /// </param> /// <param name="useOfTechniques">The use of each elimination technique.</param> public SolverResults(PuzzleStatus status, PuzzleState state, int numberOfDecisionPoints, Dictionary <EliminationTechnique, int> useOfTechniques) { _status = status; _puzzles.Add(state); _numberOfDecisionPoints = numberOfDecisionPoints; _useOfTechniques = useOfTechniques; }
public static void TransplierA(PuzzleStatus __instance) { if (__instance.bonusRound) { return; } __instance.AddResourceValue(PuzzleResourceType.AFFECTION, 100000, false); }
public override void Setup() { timeRemaining = TIME_LIMIT; hold = true; status = PuzzleStatus.INPROGRESS; dio = this.transform.FindChild("Dio").GetComponent<Rigidbody2D>(); startPosition = dio.position; }
public void PointDown() { puzzleStatus = PuzzleStatus.Picked; mapManager.PlayMusic("pickup"); if (positionID != -1) { puzzleMap.transform.GetChild(positionID - 1).GetComponent <MapInfo>().setPlaceState(false); } }
public void PointUp() { puzzleStatus = PuzzleStatus.Idle; mapManager.PlayMusic("putdown"); bool findNearestMap = false; float minDist = 200; int minIndex = 0; int curIndex = 0; foreach (Transform child in puzzleMap.transform) { Vector3 mapPos = child.GetComponent <RectTransform>().position; Vector3 touchPos = this.GetComponent <RectTransform>().position; float tmpDist = Vector3.Distance(mapPos, touchPos); if (tmpDist < distThreshold) { findNearestMap = true; if (minDist > tmpDist) { minDist = tmpDist; minIndex = curIndex; } } curIndex++; } if (!findNearestMap || puzzleMap.transform.GetChild(minIndex).GetComponent <MapInfo>().getPlaceState()) { puzzleManager.SetMapPos(this.id); //this.gameObject.GetComponent<RectTransform>().position = originPos; positionID = -1; } else { if (findNearestMap) { this.GetComponent <RectTransform>().position = puzzleMap.transform.GetChild(minIndex).GetComponent <RectTransform>().position; positionID = puzzleMap.transform.GetChild(minIndex).GetComponent <MapInfo>().getMapID(); puzzleMap.transform.GetChild(minIndex).GetComponent <MapInfo>().setPlaceState(true); } if (mapManager.checkMapFull()) { if (mapManager.checkAnswerCorrect()) { mapManager.ShowPass(); } else { mapManager.ShowFailed(); } } } }
/// <summary>Initializes the PuzzleState.</summary> /// <param name="state">The state to be cloned into this new instance.</param> private PuzzleState(PuzzleState state) { // We don't use MemberwiseClone here as the new state should not share references _boxSize = state._boxSize; // immutable once created _gridSize = state._gridSize; // immutable once created _grid = (byte?[, ])state._grid.Clone(); _status = state._status; // immutable once created _filledCells = state._filledCells; // immutable once created _difficulty = state._difficulty; // immutable once created }
/// <summary> /// This should be called exactly once before actually running a puzzle. /// This will initialize all variables needed by the puzzle. /// Only put code that can execute in 1 frame here. /// </summary> override public void Setup() { timeRemaining = timeLimit; Vector3 camPosition = this.transform.FindChild("Camera Point").position; Camera cam1 = GameObject.Find("P1 Camera").GetComponent<Camera>(); cam1.transform.position = camPosition; Camera cam2 = GameObject.Find("P2 Camera").GetComponent<Camera>(); cam2.transform.position = camPosition; status = PuzzleStatus.INPROGRESS; }
public override void Setup() { timeRemaining = TIME_LIMIT; good = true; playerDied = false; status = PuzzleStatus.INPROGRESS; // Generates the "solution" // Need left torque = right torque float leftLoc = -Random.Range(AREA_X_MIN, AREA_X_MAX); float leftMass = 10.0f; float rightLoc = Random.Range(AREA_X_MIN, AREA_X_MAX); float rightMass = -leftLoc * leftMass / rightLoc; // Generates spawn points float leftSpawn = -(AREA_X_MAX + AREA_X_MIN) / 2;//-Random.Range(AREA_X_MIN, AREA_X_MAX); float rightSpawn = (AREA_X_MAX + AREA_X_MIN) / 2;// Random.Range(AREA_X_MIN, AREA_X_MAX); // Player 1 is on the left... for now. leftWeight = this.transform.FindChild("Left Weight").GetComponent<Weight>(); leftBody = leftWeight.GetComponent<Rigidbody2D>(); leftBody.position = new Vector2(leftSpawn, leftBody.position.y); leftBody.mass = leftMass; // Player 2 rightWeight = this.transform.FindChild("Right Weight").GetComponent<Weight>(); rightBody = rightWeight.GetComponent<Rigidbody2D>(); rightBody.position = new Vector2(rightSpawn, rightBody.position.y); rightBody.mass = rightMass; // Adjust camera. // Save camera positions then move both to our camera point. camPosition = this.transform.FindChild("Camera Point").position; cam1 = GameObject.Find("P1 Camera").GetComponent<Camera>(); Debug.Log("Cam position" + cam1.transform.position); oldCam1Pos = cam1.transform.position; cam1.transform.position = camPosition; cam2 = GameObject.Find("P2 Camera").GetComponent<Camera>(); oldCam2Pos = cam2.transform.position; cam2.transform.position = camPosition; seeSawBody = this.transform.FindChild("SeeSaw Board").GetComponent<Rigidbody2D>(); if(tutorialMode) { leftBody.mass = 10.0f; rightBody.mass = 11.0f; seeSawBody.angularDrag = 1;//1000000.0f; } }
/// <summary>Gets or sets the cell value.</summary> /// <param name="cell">The coordinates of the cell whose value is to be set or retrieved.</param> /// <returns>The value of the specified cell, or null if it has no value.</returns> public byte?this[Point cell] { get { return(_grid[cell.X, cell.Y]); } set { byte?oldValue = _grid[cell.X, cell.Y]; if (oldValue != value) { _status = PuzzleStatus.Unknown; _filledCells = null; _grid[cell.X, cell.Y] = value; OnStateChanged(); //cell, oldValue, value); } } }
public override void Execute() { if(timeRemaining >= 0.0f) { timeRemaining -= Time.deltaTime; } else { status = PuzzleStatus.SUCCESS; } if(dio.position.y < -8.0f) { dio.position = startPosition; hold = true; } dio.isKinematic = hold; }
private void CheckState() { if (containerRequirements.Count == 2) { pStatus = PuzzleStatus.Empty; } else if (containerRequirements.Count == 1) { switch (containerRequirements[0]) { case "Ruby Gem": pStatus = PuzzleStatus.Ruby; break; case "Emerald Gem": pStatus = PuzzleStatus.Emerald; break; } } else { pStatus = PuzzleStatus.Both; } }
public override void Setup() { status = PuzzleStatus.INPROGRESS; timeRemaining = timeLimit; turn = Random.Range(0, 2); sequence = new List<char>(); for (int i = 0; i < totalSequenceLength; i++) { sequence.Add(LEGAL_LETTERS[Random.Range(0, 6)]); } inputCorrect = false; sequence[0] = 'A'; // Bubbles p1bubble = this.transform.FindChild("P1 Bubble").GetComponent<SpeechBubble>(); p2bubble = this.transform.FindChild("P2 Bubble").GetComponent<SpeechBubble>(); p1bubble.Init(); p2bubble.Init(); ShowBubble(turn, sequence[0]); HideBubble((turn + 1) % 2); // Pointer pointer = this.transform.FindChild("Pointer").GetComponent<Pointer>(); pointer.SetFirst(turn); // Adjust camera. // Save camera positions then move both to our camera point. camPosition = this.transform.FindChild("Camera Point").position; cam1 = GameObject.Find("P1 Camera").GetComponent<Camera>(); oldCam1Pos = cam1.transform.position; cam1.transform.position = camPosition; cam2 = GameObject.Find("P2 Camera").GetComponent<Camera>(); oldCam2Pos = cam2.transform.position; cam2.transform.position = camPosition; }
/// <summary> /// This is the main execution method for a puzzle. /// Should be called every Update() to run. /// </summary> override public void Execute() { timeRemaining -= Time.deltaTime; if (status == PuzzleStatus.INPROGRESS) { if (player1.col.IsTouching(player2.col)) { player1.gameObject.layer = LayerMask.NameToLayer("Default"); player2.gameObject.layer = LayerMask.NameToLayer("Default"); if (Mathf.Abs(player1.transform.position.y - player2.transform.position.y) <= 0.2f && player1.transform.position.x < player2.transform.position.x) { player1.enabled = false; player2.enabled = false; status = PuzzleStatus.SUCCESS; } } else { player1.gameObject.layer = LayerMask.NameToLayer("P1 ONLY"); player2.gameObject.layer = LayerMask.NameToLayer("P2 ONLY"); } } }
public FullBoard() { GameBoard = new List <Cell>(); Status = PuzzleStatus.Normal; }
/// <summary> /// This is the main execution method for a puzzle. /// Should be called every Update() to run. /// </summary> override public void Execute() { if(status == PuzzleStatus.INPROGRESS) { timeRemaining -= Time.deltaTime; if (player1.playerStatus == ApplePuzzlePlayer.PlayerStatus.PRIMED && player2.playerStatus == ApplePuzzlePlayer.PlayerStatus.PRIMED) { status = PuzzleStatus.SUCCESS; } else if (timeRemaining < 0) { status = PuzzleStatus.FAIL; } } }
/// <summary> /// This should be called exactly once before actually running a puzzle. /// This will initialize all variables needed by the puzzle. /// Only put code that can execute in 1 frame here. /// </summary> override public void Setup() { status = PuzzleStatus.INPROGRESS; timeRemaining = timeLimit; cam1 = GameObject.Find("P1 Camera").GetComponent<CameraControls>(); cam1.Target(fallingPlayer.GetTarget()); oldCam1Size = cam1.GetComponent<Camera>().orthographicSize; cam1.GetComponent<Camera>().orthographicSize = cameraSize; cam2 = GameObject.Find("P2 Camera").GetComponent<CameraControls>(); cam2.Target(fallingPlayer.GetTarget()); oldCam2Size = cam2.GetComponent<Camera>().orthographicSize; cam2.GetComponent<Camera>().orthographicSize = cameraSize; catcherBounds = catcher.GetComponent<Collider2D>(); if(fallingPlayer.assignment == FallerPlayer.PlayerAssignment.P1) { catcher.GetComponentInChildren<SpriteRenderer>().color = fallingPlayer.P2Color; } else { catcher.GetComponentInChildren<SpriteRenderer>().color = fallingPlayer.P1Color; } float newX = catcher.transform.position.x + Random.Range(-CATCHER_RADIUS, CATCHER_RADIUS); catcher.transform.position = new Vector3(newX, catcher.transform.position.y); }
public EventPuzzle(PuzzleStatus status, string gameObjectName) { Status = status; GameObjectName = gameObjectName; }
void Start() { pStatus = PuzzleStatus.Empty; Initialize(); }
public override void Execute() { if(status == PuzzleStatus.INPROGRESS) { timeRemaining -= Time.deltaTime; if(timeRemaining <= 0.0f) { timeRemaining = 0.0f; status = PuzzleStatus.FAIL; } else { if(inputCorrect) { HideBubble(turn); turn = (turn + 1) % 2; sequence.RemoveAt(0); if (sequence.Count == 0) { status = PuzzleStatus.SUCCESS; return; } else { inputCorrect = false; } ShowBubble(turn, sequence[0]); pointer.PointAt(turn); } } } }
/// <summary> /// This is the main execution method for a puzzle. /// Should be called every Update() to run. /// </summary> override public void Execute() { switch(status) { case PuzzleStatus.INPROGRESS: timeRemaining -= Time.deltaTime; if(timeRemaining < 0.0f) { timeRemaining = 0.0f; status = PuzzleStatus.SPECIAL; } else { if (player1.playerStatus == KissPuzzlePlayer.PlayerStatus.PRIMED && player2.playerStatus == KissPuzzlePlayer.PlayerStatus.PRIMED) { player1.Succeed(); player2.Succeed(); this.kissSound.Play (); win = true; status = PuzzleStatus.SPECIAL; } } break; case PuzzleStatus.SPECIAL: // Special animation? :P if(win) { status = PuzzleStatus.SUCCESS; } else { status = PuzzleStatus.FAIL; } break; default: break; } }
public EventPuzzle(PuzzleStatus status) { Status = status; IsTimed = false; GameObjectName = null; }
// Start is called before the first frame update void Start() { positionID = -1; puzzleStatus = new PuzzleStatus(); }
public static void DisplayOurInfo(UiCellphoneAppStatus __instance, ref PuzzleStatus ____puzzleStatus) { UiCellphoneAppStatus status = __instance; RunTimer run = HP2SR.run; if (justFinishedDate) { justFinishedDate = false; status.affectionMeter.valueLabelPro.richText = true; status.affectionMeter.valueLabelPro.text = "<color=" + RunTimer.colors[(int)run.splitColor] + ">" + run.splitText + "</color>"; Sequence seq = DOTween.Sequence(); seq.Insert(0f, status.canvasGroupDate.DOFade(1, 0.32f).SetEase(Ease.Linear)); seq.Insert(0f, status.canvasGroupLeft.DOFade(1, 0.32f).SetEase(Ease.Linear)); seq.Insert(0f, status.canvasGroupRight.DOFade(1, 0.32f).SetEase(Ease.Linear)); Game.Manager.Time.Play(seq, status.pauseBehavior.pauseDefinition, 0f); if (run.prevColor == RunTimer.SplitColors.BLUE) { status.sentimentRollerRight.valueName = "THIS SPLIT"; status.sentimentRollerRight.maxName = "THIS SPLIT"; status.sentimentRollerRight.nameLabel.text = "THIS SPLIT"; status.sentimentRollerRight.valueLabelPro.text = run.prevText; } else if (run.prevColor == RunTimer.SplitColors.RED) { status.passionRollerRight.valueName = "THIS SPLIT"; status.passionRollerRight.maxName = "THIS SPLIT"; status.passionRollerRight.nameLabel.text = "THIS SPLIT"; status.passionRollerRight.valueLabelPro.text = run.prevText; } if (run.goldText != "") { status.movesRoller.valueName = "GOLD"; status.movesRoller.maxName = "GOLD"; status.movesRoller.nameLabel.text = "GOLD"; status.movesRoller.valueLabelPro.text = run.goldText; } } if (itsRewindTime) { itsRewindTime = false; status.sentimentRollerRight.valueName = "SENTIMENT"; status.sentimentRollerRight.maxName = "SENTI... • MAX"; status.sentimentRollerRight.Reset(____puzzleStatus.girlStatusRight.sentiment, 40); status.passionRollerRight.valueName = "PASSION"; status.passionRollerRight.maxName = "PASSION • MAX"; status.passionRollerRight.Reset(____puzzleStatus.girlStatusRight.passion, 100); status.movesRoller.valueName = "MOVES"; status.movesRoller.maxName = "MOVES • MAX"; status.movesRoller.Reset(____puzzleStatus.movesRemaining, ____puzzleStatus.maxMovesRemaining); } if (justGaveShoe) { justGaveShoe = false; //briefly display the affection meter for (int j = 0; j < status.simCanvasGroups.Length; j++) { status.simCanvasGroups[j].alpha = 0f; } status.affectionCanvasGroup.alpha = 1f; status.affectionMeter.valueLabelPro.richText = true; string shoeText = "<color=" + RunTimer.colors[(int)run.splitColor] + ">" + run.splitText + "</color>"; if (run.goldText != "") { shoeText += " <color=" + RunTimer.colors[(int)run.goldColor] + ">(" + run.goldText + ")</color>"; } status.affectionMeter.valueLabelPro.text = shoeText; } if (noMoreShoe) { noMoreShoe = false; status.affectionCanvasGroup.alpha = 0f; for (int j = 0; j < status.simCanvasGroups.Length; j++) { status.simCanvasGroups[j].alpha = 1f; } } }
/// <summary> /// This is the main execution method for a puzzle. /// Should be called every Update() to run. /// </summary> override public void Execute() { if(status == PuzzleStatus.INPROGRESS) { timeRemaining -= Time.deltaTime; if (fallingPlayer.transform.position.y - catcher.transform.position.y < 35) { Time.timeScale = 0.5f; } if (timeRemaining < 0 || fallingPlayer.transform.position.y < catcher.transform.position.y - 2.0f) { Time.timeScale = 1.0f; status = PuzzleStatus.FAIL; } else if (fallingPlayer.colBody.bounds.Intersects(catcherBounds.bounds)) { Time.timeScale = 1.0f; fallingPlayer.selfBody.isKinematic = true; status = PuzzleStatus.SUCCESS; } } }
public EventPuzzle(PuzzleStatus status, bool isTimed, string brokenObjectName) { Status = status; IsTimed = isTimed; GameObjectName = brokenObjectName; }
public override void Execute() { if(timeRemaining >= 0.0f) { timeRemaining -= Time.deltaTime; if(leftBody.position.y < DEAD_ZONE_Y || rightBody.position.y < DEAD_ZONE_Y) { status = PuzzleStatus.FAIL; } if(timeRemaining < 0.0f) { timeRemaining = 0.0f; if(good) { status = PuzzleStatus.SUCCESS; } else { status = PuzzleStatus.FAIL; } } } else { // ???? } }
private bool IsDone(PuzzleStatus status) { return status == PuzzleStatus.SUCCESS || status == PuzzleStatus.FAIL; }