Ejemplo n.º 1
0
        private void OnPreRender()
        {
            if (!gameObject.activeSelf || !enabled)
            {
                return;
            }

            if (glowTexture != null)
            {
                RenderTexture.ReleaseTemporary(glowTexture);
                glowTexture = null;
            }

            if (GlowType == MKGlowType.Selective)
            {
                glowTexture = RenderTexture.GetTemporary((int)((GetComponent <Camera>().pixelWidth) / samples), (int)((GetComponent <Camera>().pixelHeight) / samples), 16, RenderTextureFormat.Default);
                SetupGlowCamera();
                SetupKeywords();
                GlowCamera.RenderWithShader(glowRenderShader, "RenderType");
            }
            else
            {
                if (GlowCamera)
                {
                    DestroyImmediate(GlowCamera);
                }
                if (GlowCameraObject)
                {
                    DestroyImmediate(GlowCameraObject);
                }
            }

            BlurMaterial.color = new Color(fullScreenGlowTint.r, fullScreenGlowTint.g, fullScreenGlowTint.b, glowIntensity);
        }
Ejemplo n.º 2
0
 private void SetupGlowCamera()
 {
     GlowCamera.CopyFrom(this.GetComponent <Camera>());
     GlowCamera.clearFlags      = CameraClearFlags.SolidColor;
     GlowCamera.rect            = new Rect(0, 0, 1, 1);
     GlowCamera.backgroundColor = new Color(0, 0, 0, 0);
     GlowCamera.cullingMask     = GlowRenderLayer;
     GlowCamera.targetTexture   = this.m_GlowTexture;
 }
Ejemplo n.º 3
0
 private void SetupGlowCamera()
 {
     GlowCamera.CopyFrom(GetComponent <Camera>());
     GlowCamera.clearFlags      = CameraClearFlags.SolidColor;
     GlowCamera.rect            = new Rect(0, 0, 1, 1);
     GlowCamera.backgroundColor = new Color(0, 0, 0, 0);
     GlowCamera.cullingMask     = glowLayer;
     GlowCamera.targetTexture   = glowTexture;
     if (GlowCamera.actualRenderingPath != RenderingPath.VertexLit)
     {
         GlowCamera.renderingPath = RenderingPath.VertexLit;
     }
 }
Ejemplo n.º 4
0
 void Update()
 {
     if (!GlowCamera.GlowMenuActive())
     {
         if (Input.GetMouseButton(0))
         {
             if (Time.time >= NextFireTime)
             {
                 Instantiate(LaserPrefab, transform.position, transform.rotation);
                 GetComponent <AudioSource>().PlayOneShot(LaserShootClip);
                 NextFireTime = Time.time + FireRate;
             }
         }
     }
 }
Ejemplo n.º 5
0
    void Update()
    {
        if (GlowCamera.GlowMenuActive())
        {
            return;
        }

        sensitivityX = 3;
        sensitivityY = 3;

        Quaternion yQuaternion;
        Quaternion xQuaternion;

        if (axes == RotationAxes.MouseXAndY)
        {
            // Read the mouse input axis
            rotationX += Input.GetAxis("Mouse X") * sensitivityX;
            rotationY += Input.GetAxis("Mouse Y") * sensitivityY;

            rotationX = ClampAngle(rotationX, minimumX, maximumX);
            rotationY = ClampAngle(rotationY, minimumY, maximumY);

            xQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up);
            yQuaternion = Quaternion.AngleAxis(rotationY, Vector3.left);

            transform.localRotation = originalRotation * xQuaternion * yQuaternion;
        }
        else if (axes == RotationAxes.MouseX)
        {
            rotationX += Input.GetAxis("Mouse X") * sensitivityX;
            rotationX  = ClampAngle(rotationX, minimumX, maximumX);

            xQuaternion             = Quaternion.AngleAxis(rotationX, Vector3.up);
            transform.localRotation = originalRotation * xQuaternion;
        }
        else
        {
            rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
            rotationY  = ClampAngle(rotationY, minimumY, maximumY);

            yQuaternion             = Quaternion.AngleAxis(rotationY, Vector3.left);
            transform.localRotation = originalRotation * yQuaternion;
        }
    }
Ejemplo n.º 6
0
        private void OnPreRender()
        {
            if (!gameObject.activeSelf || !this.enabled)
            {
                return;
            }

            if (m_GlowTexture != null)
            {
                RenderTexture.ReleaseTemporary(m_GlowTexture);
                m_GlowTexture = null;
            }

            if (GlowType == MKGlowType.Selective)
            {
                m_GlowTexture = RenderTexture.GetTemporary((int)((this.GetComponent <Camera>().pixelWidth) / CalculateSamples(ref m_GlowResolution)), (int)((this.GetComponent <Camera>().pixelHeight) / CalculateSamples(ref m_GlowResolution)), 16);
                SetupGlowCamera();
                SetupKeywords();
                if (GlowCamera.actualRenderingPath != RenderingPath.VertexLit)
                {
                    GlowCamera.renderingPath = RenderingPath.VertexLit;
                }
                GlowCamera.RenderWithShader(this.m_GlowRenderShader, "RenderType");
            }
            else
            {
                if (GlowCamera)
                {
                    DestroyImmediate(GlowCamera);
                }
                if (GlowCameraObject)
                {
                    DestroyImmediate(GlowCameraObject);
                }
            }

            Mathf.Clamp(BlurSpread, 0.2f, 2f);
            Mathf.Clamp(BlurIterations, 0, 11);
            Mathf.Clamp(BlurOffset, 0.0f, 4.0f);
            Mathf.Clamp(Samples, 2, 16);
            Mathf.Clamp(GlowIntensity, 0f, 1f);
        }
Ejemplo n.º 7
0
    void Update()
    {
        if (GlowCamera.GlowMenuActive())
        {
            return;
        }

        if (grounded)
        {
            CANJUMP = true;
        }
        else
        {
            CANJUMP = false;
        }

        if (grounded)
        {
            moveDirection  = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
            moveDirection  = transform.TransformDirection(moveDirection);
            moveDirection *= speed;

            if (Input.GetButton("Jump"))
            {
                moveDirection.y = jumpSpeed;
            }
        }
        else
        {
            moveDirection.y -= gravity * Time.deltaTime;
        }

        var flags = controller.Move(moveDirection * Time.deltaTime);

        grounded = (flags & CollisionFlags.CollidedBelow) != 0;
    }