// Update is called once per frame void Update() { if (player1) { if (Input.GetButtonDown("Reset") && canActuallyReset)//some levels used to use reset to progress { AudioManager.instance.RunItBack(); GridManagement.ResetScene(); } else if (Input.GetKeyDown(KeyCode.N)) { skipped = true; StartCoroutine(StartEndSequence()); } foreach (Camera camComp in camComps) { if (Input.GetAxis("Scroll") < 0) { camComp.orthographicSize = Mathf.Clamp(camComp.orthographicSize + zoomSpeed, minZoom, maxZoom); } else if (Input.GetAxis("Scroll") > 0) { camComp.orthographicSize = Mathf.Clamp(camComp.orthographicSize - zoomSpeed, minZoom, maxZoom); } } } if (player1 && !moving && Input.GetButtonDown("Fire")) { iterations++; iterationText.text = "steps: " + iterations; Iterate(); } else if (!GridManagement.playerDead) //if the player is dead you can still scroll and iterate but you can't win or move { if (Input.GetAxis(hInput) < -inputThresh) { dir = -transform.right; } else if (Input.GetAxis(hInput) > inputThresh) { dir = transform.right; } else if (Input.GetAxis(vInput) > inputThresh) { dir = transform.up; } else if (Input.GetAxis(vInput) < -inputThresh) { dir = -transform.up; } else { return; } if (!moving) { GameObject thingInTheWay = GridManagement.getObjectFromPosition(transform.position + dir); if (thingInTheWay) { if (canPush) { if (thingInTheWay.tag == "Pushable") { Move(thingInTheWay); //update the grid to account for the push Invoke("UpdateCellCounts", GridMovementGeneral.instance.timeForLerps + .1f); } } } moving = true; Move(gameObject); Invoke("ResetMovin", GridMovementGeneral.instance.timeForLerps + .1f); } } }