diff --git a/Assets/Scripts.meta b/Assets/Scripts.meta new file mode 100644 index 0000000..27e71d0 --- /dev/null +++ b/Assets/Scripts.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 40764ebe822b819449a2b0cf923f4c2e +folderAsset: yes +timeCreated: 1466858656 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/New Material 1.mat b/Assets/Scripts/New Material 1.mat new file mode 100644 index 0000000..5f8350f Binary files /dev/null and b/Assets/Scripts/New Material 1.mat differ diff --git a/Assets/Scripts/New Material 1.mat.meta b/Assets/Scripts/New Material 1.mat.meta new file mode 100644 index 0000000..d090321 --- /dev/null +++ b/Assets/Scripts/New Material 1.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a1d7ff165c6400643b2057a06b2fb899 +timeCreated: 1466869200 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/New Material.mat b/Assets/Scripts/New Material.mat new file mode 100644 index 0000000..4537826 Binary files /dev/null and b/Assets/Scripts/New Material.mat differ diff --git a/Assets/Scripts/New Material.mat.meta b/Assets/Scripts/New Material.mat.meta new file mode 100644 index 0000000..e3f24f3 --- /dev/null +++ b/Assets/Scripts/New Material.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6a724011859964946811843b7f01d49e +timeCreated: 1466858776 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PlayerMovement.cs b/Assets/Scripts/PlayerMovement.cs index 34366a5..ddaa2e4 100644 --- a/Assets/Scripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerMovement.cs @@ -5,19 +5,31 @@ public class PlayerMovement : MonoBehaviour { public float speed = 0f; public float turn = 0f; + public GameObject camera; + public Rigidbody characterRigidBody; //private Rigidbody rb; // Update is called once per frame void Update () { - if (Input.GetKey(KeyCode.UpArrow)) - transform.Translate(Vector3.forward * speed * Time.deltaTime); - if (Input.GetKey(KeyCode.DownArrow)) - transform.Translate(-Vector3.forward * speed * Time.deltaTime); - if (Input.GetKey(KeyCode.LeftArrow)) - transform.Rotate(Vector3.up, -turn * Time.deltaTime); - if (Input.GetKey(KeyCode.RightArrow)) - transform.Rotate(Vector3.up, turn * Time.deltaTime); + Vector3 fowardVector = new Vector3(camera.transform.forward.x, 0, camera.transform.forward.z); + if (Input.GetAxis("Vertical")>0) + { + + characterRigidBody.velocity = ( fowardVector * speed * Time.deltaTime); + } + else if (Input.GetAxis("Vertical")<0) + { + characterRigidBody.velocity = (-fowardVector * speed * Time.deltaTime); + } + if (Input.GetAxis("Horizontal")<0) + { + characterRigidBody.velocity = (Vector3.Cross(-transform.up, fowardVector) * speed * Time.deltaTime); + } + else if (Input.GetAxis("Horizontal") > 0) + { + characterRigidBody.velocity = (Vector3.Cross(transform.up, fowardVector) * speed * Time.deltaTime); + } } } diff --git a/Assets/Scripts/PlayerMovement.cs.meta b/Assets/Scripts/PlayerMovement.cs.meta new file mode 100644 index 0000000..61dd72f --- /dev/null +++ b/Assets/Scripts/PlayerMovement.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e02d4438d816e344abb40991894780c3 +timeCreated: 1466858657 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PostEffectScript.cs b/Assets/Scripts/PostEffectScript.cs new file mode 100644 index 0000000..14fb0d2 --- /dev/null +++ b/Assets/Scripts/PostEffectScript.cs @@ -0,0 +1,36 @@ +using UnityEngine; +using System.Collections; +[ExecuteInEditMode] +public class PostEffectScript : MonoBehaviour { + public Material mat; + public float blindness = 0.5f; + public Rigidbody character; + public float blindnessRatio = 0.1f; + public float velocity; + // Use this for initialization + void Start () { + + } + + // Update is called once per frame + void Update () { + + } + void OnRenderImage(RenderTexture src, RenderTexture dest) + { + if (character.velocity.magnitude > 0) + { + blindness = character.velocity.normalized.magnitude * blindnessRatio; + blindnessRatio += 0.01f; + } + else if (blindnessRatio >= 0.1f) + { + blindness = character.velocity.normalized.magnitude * blindnessRatio; + blindnessRatio = 0.1f; + } + + + mat.SetFloat("_Blindness", blindness); + Graphics.Blit(src, dest,mat); + } +} diff --git a/Assets/Scripts/PostEffectScript.cs.meta b/Assets/Scripts/PostEffectScript.cs.meta new file mode 100644 index 0000000..c2206f5 --- /dev/null +++ b/Assets/Scripts/PostEffectScript.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: ec76a4a1cda1e3a4bb07acf36d2d1e01 +timeCreated: 1466858765 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/PostEffectShader.shader b/Assets/Scripts/PostEffectShader.shader new file mode 100644 index 0000000..948484a --- /dev/null +++ b/Assets/Scripts/PostEffectShader.shader @@ -0,0 +1,58 @@ + Shader "Custom/PostEffectShader" +{ + Properties + { + _Blindness("Blindness", Float) = 0.6 + _MainTex("Texture", 2D) = "white" {} + + } + SubShader + { + // No culling or depth + Cull Off ZWrite Off ZTest Always + + Pass + { + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + + #include "UnityCG.cginc" + + struct appdata + { + float4 vertex : POSITION; + float2 uv : TEXCOORD0; + }; + + struct v2f + { + float2 uv : TEXCOORD0; + float4 vertex : SV_POSITION; + }; + + v2f vert (appdata v) + { + v2f o; + o.vertex = mul(UNITY_MATRIX_MVP, v.vertex); + o.uv = v.uv; + return o; + } + + sampler2D _MainTex; + float _Blindness; + + fixed4 frag (v2f i) : SV_Target + { + fixed4 col = tex2D(_MainTex, i.uv); + col.r = col.r+ _Blindness; + col.g = col.g+_Blindness; + col.b = col.b+_Blindness; + // just invert the colors + //col = 1 - col; + return col; + } + ENDCG + } + } +} diff --git a/Assets/Scripts/PostEffectShader.shader.meta b/Assets/Scripts/PostEffectShader.shader.meta new file mode 100644 index 0000000..257c427 --- /dev/null +++ b/Assets/Scripts/PostEffectShader.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8af73b3d4929e6c4bbf312b61e959c45 +timeCreated: 1466858754 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/ViewControl.cs b/Assets/Scripts/ViewControl.cs new file mode 100644 index 0000000..2bd47f6 --- /dev/null +++ b/Assets/Scripts/ViewControl.cs @@ -0,0 +1,42 @@ +using UnityEngine; +using System.Collections; + +public class ViewControl : MonoBehaviour +{ + + // Speed at which the camera will catch up to the mouse pointer location + public float smoothing = 1.5f; + public float mouseSensitivity = 100.0f; + public float clampAngle = 80.0f; + + private float rotY = 0.0f; + // rotation around the up/y axis + private float rotX = 0.0f; + // rotation around the right/x axis + + // Use this for initialization + void Start() + { + Cursor.lockState = CursorLockMode.Locked; + Cursor.visible = false; + + Vector3 rot = transform.localRotation.eulerAngles; + rotY = rot.y; + rotX = rot.x; + } + + // Called once every physics update + void FixedUpdate() + { + float mouseX = Input.GetAxis("Mouse X"); + float mouseY = -Input.GetAxis("Mouse Y"); + + rotY += mouseX * mouseSensitivity * Time.deltaTime; + rotX += mouseY * mouseSensitivity * Time.deltaTime; + + rotX = Mathf.Clamp(rotX, -clampAngle, clampAngle); + + Quaternion localRotation = Quaternion.Euler(rotX, rotY, 0.0f); + transform.rotation = localRotation; + } +} diff --git a/Assets/Scripts/ViewControl.cs.meta b/Assets/Scripts/ViewControl.cs.meta new file mode 100644 index 0000000..e9d4066 --- /dev/null +++ b/Assets/Scripts/ViewControl.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: e0d46d2696637bd4994804f7b9e4d3fe +timeCreated: 1466858657 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/images.png b/Assets/Scripts/images.png new file mode 100644 index 0000000..6e40a66 Binary files /dev/null and b/Assets/Scripts/images.png differ diff --git a/Assets/Scripts/images.png.meta b/Assets/Scripts/images.png.meta new file mode 100644 index 0000000..6ad476c --- /dev/null +++ b/Assets/Scripts/images.png.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: d291956c75df3674396ed3b0bff90c13 +timeCreated: 1466869186 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/sky-1141928_960_720.jpg b/Assets/Scripts/sky-1141928_960_720.jpg new file mode 100644 index 0000000..1806f6b Binary files /dev/null and b/Assets/Scripts/sky-1141928_960_720.jpg differ diff --git a/Assets/Scripts/sky-1141928_960_720.jpg.meta b/Assets/Scripts/sky-1141928_960_720.jpg.meta new file mode 100644 index 0000000..33757ca --- /dev/null +++ b/Assets/Scripts/sky-1141928_960_720.jpg.meta @@ -0,0 +1,57 @@ +fileFormatVersion: 2 +guid: cd66694a22ab80445882e746f99c2568 +timeCreated: 1466867515 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 2 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + linearTexture: 0 + correctGamma: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 0 + cubemapConvolution: 0 + cubemapConvolutionSteps: 7 + cubemapConvolutionExponent: 1.5 + seamlessCubemap: 0 + textureFormat: -1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + rGBM: 0 + compressionQuality: 50 + allowsAlphaSplitting: 0 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaIsTransparency: 0 + textureType: -1 + buildTargetSettings: [] + spriteSheet: + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: