void handleInput() { Transform posterTransform = allImageTargets[selectedTarget].transform.GetChild(0); Poster poster = posterTransform.GetComponent <Poster>(); // Cycle selection if (Input.GetKeyDown(KeyCode.LeftArrow) || Input.GetKeyDown(KeyCode.RightArrow)) { if (Input.GetKeyDown(KeyCode.LeftArrow)) { selectedTarget = (selectedTarget - 1 + imageTargetsCount) % imageTargetsCount; } if (Input.GetKeyDown(KeyCode.RightArrow)) { selectedTarget = (selectedTarget + 1) % imageTargetsCount; } // TODO: inefficient, fix later indexText = "Target Index: " + selectedTarget.ToString(); // TODO: Have initial selection highlighted for (int i = 0; i < imageTargetsCount; i++) { Transform thisPosterTransform = allImageTargets[i].transform.GetChild(0); Renderer renderer = thisPosterTransform.GetComponent <Renderer>(); renderer.material = (i == selectedTarget) ? grayscale : spritesDefault; } } // Cycle poster choice else if (Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKey(KeyCode.DownArrow)) { int spriteCount = allSprites.Length; if (Input.GetKeyDown(KeyCode.UpArrow)) { poster.spriteIndex = (poster.spriteIndex + 1) % spriteCount; } if (Input.GetKeyDown(KeyCode.DownArrow)) { poster.spriteIndex = (poster.spriteIndex - 1 + spriteCount) % spriteCount; } // Replace sprite with sprite from index posterTransform.GetComponent <SpriteRenderer>().sprite = (Sprite)allSprites[poster.spriteIndex]; poster.ScaleReal(); } // Change size of poster else if (Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.S) || Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.D)) { if (Input.GetKeyDown(KeyCode.W)) { poster.realHeight += realHeightDelta; } if (Input.GetKeyDown(KeyCode.S) && poster.realHeight - realHeightDelta > minPosterLength) { poster.realHeight -= realHeightDelta; } if (Input.GetKeyDown(KeyCode.D)) { poster.realWidth += realWidthDelta; } if (Input.GetKeyDown(KeyCode.A) && poster.realWidth - realWidthDelta > minPosterLength) { poster.realWidth -= realWidthDelta; } poster.ScaleReal(); } }