Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- public class Viewtest : MonoBehaviour {
- public Camera cam;
- public float somenum = 0.1f;
- public bool isExpanded = false;
- // Use this for initialization
- void Start () {
- cam = this.GetComponent<Camera> ();
- }
- // Update is called once per frame
- void Update () {
- if (Input.GetKeyDown (KeyCode.UpArrow)){
- isExpanded = !isExpanded;
- cam.rect = new Rect(1f * somenum++ * 0.01f,1f * somenum++ * 0.01f,1f * somenum++ * 0.01f,1f * somenum++ * 0.01f);
- }
- if (Input.GetKeyDown (KeyCode.DownArrow)){
- isExpanded = !isExpanded;
- cam.rect = new Rect(1f * somenum-- * 0.01f,1f * somenum-- * 0.01f,1f * somenum-- * 0.01f,1f * somenum-- * 0.01f);
- }
- if (Input.GetKeyDown (KeyCode.LeftArrow)){
- isExpanded = !isExpanded;
- cam.rect = new Rect(somenum++ * -0.01f,1f * somenum++ * 0.01f,1f * somenum++,1f * somenum++);
- }
- if (Input.GetKeyDown (KeyCode.RightArrow)){
- isExpanded = !isExpanded;
- cam.rect = new Rect(somenum-- * -0.01f,1f * somenum-- * 0.01f,1f * somenum--,1f * somenum--);
- }
- }
- }
Add Comment
Please, Sign In to add comment