Exemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown("a"))
     {
         if (current != null)
         {
             current.transform.parent = null;
             current.GetComponent <Rigidbody>().isKinematic = false;
         }
         this.startTrack();
         current = Instantiate(cube, Camera.main.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 3)), transform.rotation);
         current.transform.parent = this.transform.parent.gameObject.transform;
         current.GetComponent <Rigidbody>().isKinematic = true;
     }
     if (Input.GetKey("a"))
     {
         CubeData c = current.GetComponent <CubeData>();
         c.increase();
     }
     if (Input.GetKeyUp("a"))
     {
         current.transform.parent = null;
         current.GetComponent <Rigidbody>().isKinematic = false;
     }
     if (Input.GetKeyDown("m"))
     {
         toggleGravity();
     }
     if (Input.GetKeyDown("l"))
     {
         toggleGlobal();
     }
     if (Input.GetKey("b"))
     {
         GameObject[] lights = GameObject.FindGameObjectsWithTag("Light");
         foreach (GameObject l in lights)
         {
             CubeData c = l.GetComponent <CubeData>();
             c.increase();
         }
     }
     if (Input.GetKey("n"))
     {
         GameObject[] lights = GameObject.FindGameObjectsWithTag("Light");
         foreach (GameObject l in lights)
         {
             CubeData c = l.GetComponent <CubeData>();
             c.decrease();
         }
     }
     if (Input.GetKey("k"))
     {
         CubeData.globalColor = CubeData.hueRotate(CubeData.globalColor, 0.003f);
         GameObject[] lights = GameObject.FindGameObjectsWithTag("Light");
         foreach (GameObject l in lights)
         {
             CubeData c = l.GetComponent <CubeData>();
             c.hueRotate();
         }
     }
     if (Input.GetKeyDown("v"))
     {
         ScreenCapture.CaptureScreenshot(System.DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".png");
     }
     if (dsps.Count > 0)
     {
         addRandomCube();
     }
     checkTimeChange();
 }