void LateUpdate()
    {
        if (Input.GetButtonDown("Fire1"))
        {
            //disable text
            dMenu.hintText.enabled = false;
            dMenu.textFade         = 0;
            dMenu.hintTimer        = 0;

            //play sound
            shutterSound.Play();

            //save image
            StartCoroutine(ScreenshotEncode());

            //save data
            PhotoInfo photoInfo = new PhotoInfo(raycastDetail * raycastDetail);
            //cast rays
            for (int i = 0; i < raycastDetail; i++)
            {
                float xAngle = vertFov * (.5f - (i + .5f) / (float)raycastDetail);
                for (int j = 0; j < raycastDetail; j++)
                {
                    float      yAngle = horizFov * (.5f - (j + .5f) / (float)raycastDetail);
                    RaycastHit rayHit;
                    Transform  mCam  = Camera.main.transform;
                    Vector3    angle = mCam.rotation * Quaternion.Euler(xAngle, yAngle, 0) * Vector3.forward;
                    Ray        ray   = new Ray(mCam.position, angle);
                    if (Physics.Raycast(ray, out rayHit))
                    {
                        PipeInfoHolder pipe = rayHit.transform.GetComponent <PipeInfoHolder>();
                        if (pipe != null)
                        {
                            photoInfo.pipeDetection[i * raycastDetail + j] = pipe.info;
                            //GameObject.CreatePrimitive(PrimitiveType.Sphere).transform.position = rayHit.point;//Debug spheres
                        }
                    }
                }
            }
            storage.infos.Add(photoInfo);
            Debug.Log("pipes: " + photoInfo.countPipes() + "" + " density: " + photoInfo.pipeDensity());
        }
    }
Beispiel #2
0
 public void grow()
 {
     transform.localScale = normalScale * biggerScale;
     Debug.Log("pipes: " + info.countPipes() + " density: " + info.pipeDensity() + " redness " + info.detectColor(Color.red));
 }