mirror of
https://github.com/ConjureETS/MeltedBananasOJam2016.git
synced 2026-03-24 02:21:06 +00:00
View and movement merge + stay a while mechanic first pass
This commit is contained in:
parent
45b3f1633e
commit
a6ef2b8f9e
9
Assets/Scripts.meta
Normal file
9
Assets/Scripts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 40764ebe822b819449a2b0cf923f4c2e
|
||||
folderAsset: yes
|
||||
timeCreated: 1466858656
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Scripts/New Material 1.mat
Normal file
BIN
Assets/Scripts/New Material 1.mat
Normal file
Binary file not shown.
8
Assets/Scripts/New Material 1.mat.meta
Normal file
8
Assets/Scripts/New Material 1.mat.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a1d7ff165c6400643b2057a06b2fb899
|
||||
timeCreated: 1466869200
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Scripts/New Material.mat
Normal file
BIN
Assets/Scripts/New Material.mat
Normal file
Binary file not shown.
8
Assets/Scripts/New Material.mat.meta
Normal file
8
Assets/Scripts/New Material.mat.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6a724011859964946811843b7f01d49e
|
||||
timeCreated: 1466858776
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
12
Assets/Scripts/PlayerMovement.cs.meta
Normal file
12
Assets/Scripts/PlayerMovement.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e02d4438d816e344abb40991894780c3
|
||||
timeCreated: 1466858657
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
36
Assets/Scripts/PostEffectScript.cs
Normal file
36
Assets/Scripts/PostEffectScript.cs
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
12
Assets/Scripts/PostEffectScript.cs.meta
Normal file
12
Assets/Scripts/PostEffectScript.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ec76a4a1cda1e3a4bb07acf36d2d1e01
|
||||
timeCreated: 1466858765
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
58
Assets/Scripts/PostEffectShader.shader
Normal file
58
Assets/Scripts/PostEffectShader.shader
Normal file
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Assets/Scripts/PostEffectShader.shader.meta
Normal file
9
Assets/Scripts/PostEffectShader.shader.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8af73b3d4929e6c4bbf312b61e959c45
|
||||
timeCreated: 1466858754
|
||||
licenseType: Free
|
||||
ShaderImporter:
|
||||
defaultTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
42
Assets/Scripts/ViewControl.cs
Normal file
42
Assets/Scripts/ViewControl.cs
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
12
Assets/Scripts/ViewControl.cs.meta
Normal file
12
Assets/Scripts/ViewControl.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0d46d2696637bd4994804f7b9e4d3fe
|
||||
timeCreated: 1466858657
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Scripts/images.png
Normal file
BIN
Assets/Scripts/images.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 529 B |
57
Assets/Scripts/images.png.meta
Normal file
57
Assets/Scripts/images.png.meta
Normal file
@ -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:
|
||||
BIN
Assets/Scripts/sky-1141928_960_720.jpg
Normal file
BIN
Assets/Scripts/sky-1141928_960_720.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 28 KiB |
57
Assets/Scripts/sky-1141928_960_720.jpg.meta
Normal file
57
Assets/Scripts/sky-1141928_960_720.jpg.meta
Normal file
@ -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:
|
||||
Loading…
x
Reference in New Issue
Block a user