Actual project things

This commit is contained in:
2016-05-18 20:02:27 +02:00
parent 1e9b3a1498
commit ce46120e5a
54 changed files with 8512 additions and 0 deletions
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

+57
View File
@@ -0,0 +1,57 @@
fileFormatVersion: 2
guid: 85505d0e2161a424c826a464c417d5ea
timeCreated: 1463570408
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:
+7201
View File
File diff suppressed because it is too large Load Diff
+78
View File
@@ -0,0 +1,78 @@
fileFormatVersion: 2
guid: bfed182f4dfcd014da54a2c0a7ebff1c
timeCreated: 1463570381
licenseType: Free
ModelImporter:
serializedVersion: 19
fileIDToRecycleName:
100000: Banana
100002: //RootNode
400000: Banana
400002: //RootNode
2300000: Banana
3300000: Banana
4300000: Banana
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleRotations: 1
optimizeGameObjects: 0
motionNodeName:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 0.001
meshCompression: 0
addColliders: 0
importBlendShapes: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
importAnimation: 1
copyAvatar: 0
humanDescription:
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
hasTranslationDoF: 0
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:
+21
View File
@@ -0,0 +1,21 @@
using UnityEngine;
using System.Collections;
public class CameraFade : MonoBehaviour {
private float alpha = 0.0F;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
int deviceIndex = 4;
alpha = SteamVR_Controller.Input(deviceIndex).GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger).x;
}
void OnRenderImage(RenderTexture src, RenderTexture dest) {
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 20d1b9d193b9a8e468350ff7c86e813e
timeCreated: 1463572818
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+15
View File
@@ -0,0 +1,15 @@
using UnityEngine;
using System.Collections;
[RequireComponent(typeof(ViewFrustrumTrigger))]
public class EnableOutOfView : MonoBehaviour {
public Renderer Renderer;
void Start () {
GetComponent<ViewFrustrumTrigger>().LeaveView += enable;
}
void enable() {
this.Renderer.enabled = true;
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3d9d290ccf232004692764ecce104c54
timeCreated: 1463581987
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+28
View File
@@ -0,0 +1,28 @@
using UnityEngine;
using System.Collections;
public class LeftController : MonoBehaviour {
// Use this for initialization
void Start () {
var trackedController = GetComponent<SteamVR_TrackedController>();
trackedController.TriggerClicked += TriggerClicked;
trackedController.Gripped += Gripped;
}
// Update is called once per frame
void Update () {
}
void TriggerClicked(object sender, ClickedEventArgs e) {
SteamVR_Fade.Start(Color.black, 2);
//var warehouseCamera = GameObject.FindWithTag("WarehouseCamera").GetComponent<SteamVR_Camera>();
//warehouseCamera.enabled = true;
}
void Gripped(object sender, ClickedEventArgs e) {
var warehouseCamera = GameObject.FindWithTag("WarehouseCamera").GetComponent<SteamVR_Camera>();
warehouseCamera.enabled = false;
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f83b43ae6f65d87439a30efca41c45b1
timeCreated: 1463578053
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+9
View File
@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 644d5d6c1e63b9f468d76875b885358d
folderAsset: yes
timeCreated: 1463570381
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
BIN
View File
Binary file not shown.
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f078d919712ac704ebd095ceb20e251c
timeCreated: 1463570381
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
BIN
View File
Binary file not shown.
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 03b6094f075a4c7409b4ccbc046f0ceb
timeCreated: 1463581717
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
+64
View File
@@ -0,0 +1,64 @@
using UnityEngine;
using System.Collections;
using Valve.VR;
[ExecuteInEditMode]
public class PlayAreaScale : MonoBehaviour {
public float Padding = 0;
public static bool GetBounds(ref HmdQuad_t pRect)
{
var initOpenVR = (!SteamVR.active && !SteamVR.usingNativeSupport);
if (initOpenVR)
{
var error = EVRInitError.None;
OpenVR.Init(ref error, EVRApplicationType.VRApplication_Other);
}
var chaperone = OpenVR.Chaperone;
bool success = (chaperone != null) && chaperone.GetPlayAreaRect(ref pRect);
if (!success)
{
Debug.LogWarning("Failed to get Calibrated Play Area bounds! Make sure you have tracking first, and that your space is calibrated.");
}
if (initOpenVR)
OpenVR.Shutdown();
return success;
}
// Use this for initialization
void OnEnable() {
StartCoroutine("UpdateBounds");
}
// Update is called once per frame
void Update () {
}
IEnumerator UpdateBounds()
{
var rect = new HmdQuad_t();
if (!GetBounds(ref rect)) {
yield return null;
}
var corners = new HmdVector3_t[] { rect.vCorners0, rect.vCorners1, rect.vCorners2, rect.vCorners3 };
float maxX = 0.0f;
float maxZ = 0.0f;
foreach (var corner in corners) {
if (corner.v0 > maxX) {
maxX = corner.v0;
}
if (corner.v2 > maxZ) {
maxZ = corner.v2;
}
}
maxX += Padding;
maxZ += Padding;
maxX *= 2;
maxZ *= 2;
transform.localScale = new Vector3(maxX, transform.localScale.y, maxZ);
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 28d6a3cfee3736b4da16612e22dddd5b
timeCreated: 1463538573
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+28
View File
@@ -0,0 +1,28 @@
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class PlayAreaWall : MonoBehaviour {
public enum DirectionEnum
{
North,
South,
East,
West
}
public DirectionEnum Direction;
public Transform PlayArea;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Direction == DirectionEnum.North)
{
transform.position = new Vector3(0F, transform.localScale.y / 2.0F, PlayArea.localScale.z / 2.0F + transform.localScale.z / 2.0F);
}
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1fa4c3eb2df433441992537b57cd3989
timeCreated: 1463542014
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+21
View File
@@ -0,0 +1,21 @@
using UnityEngine;
using System.Collections;
public class RightController : MonoBehaviour {
public GameObject banana;
public GameObject viveController;
// Use this for initialization
void Start () {
GetComponent<ViewFrustrumTrigger>().LeaveView += toggleBanana;
}
void toggleBanana() {
banana.SetActive(!banana.activeSelf);
viveController.SetActive(!viveController.activeSelf);
}
// Update is called once per frame
void Update () {
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9095495d4435e684d8b2170cd46f80fa
timeCreated: 1463579223
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+595
View File
@@ -0,0 +1,595 @@
using UnityEngine;
using System.Collections;
public class ScreenWipe : MonoBehaviour
{
public enum ZoomType
{
Grow, Shrink
}
public enum TransitionType
{
Left, Right, Up, Down
}
private Texture tex;
private RenderTexture renderTex;
private Texture2D tex2D;
private float alpha;
private bool reEnableListener;
private Material shapeMaterial;
private Transform shape;
private AnimationCurve curve;
private bool useCurve;
public static ScreenWipe use;
void Awake ()
{
if (use)
{
Debug.LogWarning("Only one instance of ScreenCrossFadePro is allowed");
return;
}
use = this;
this.enabled = false;
}
void OnGUI ()
{
GUI.depth = -9999999;
GUI.color = new Color(GUI.color.r, GUI.color.g, GUI.color.b, alpha);
GUI.DrawTexture( new Rect(0, 0, Screen.width, Screen.height), tex);
}
IEnumerator AlphaTimer ( float time )
{
float rate = 1.0f/time;
if( useCurve )
{
float t = 0.0f;
while( t < 1.0f )
{
alpha = curve.Evaluate( t );
t += Time.deltaTime * rate;
yield return 0;
}
}
else
{
for (alpha = 1.0f; alpha > 0.0f; alpha -= Time.deltaTime * rate)
{
yield return 0;
}
}
}
void CameraSetup( Camera cam1, Camera cam2, bool cam1Active, bool enableThis )
{
if (enableThis)
{
this.enabled = true;
}
cam1.gameObject.active = cam1Active;
cam2.gameObject.active = true;
AudioListener listener = cam2.GetComponent<AudioListener>();
if (listener)
{
reEnableListener = listener.enabled? true : false;
listener.enabled = false;
}
}
void CameraCleanup ( Camera cam1, Camera cam2 )
{
AudioListener listener = cam2.GetComponent<AudioListener>();
if (listener && reEnableListener) {
listener.enabled = true;
}
cam1.gameObject.active = false;
this.enabled = false;
}
public IEnumerator CrossFadePro ( Camera cam1, Camera cam2, float time )
{
if (!renderTex)
{
renderTex = new RenderTexture(Screen.width, Screen.height, 24);
}
cam1.targetTexture = renderTex;
tex = renderTex;
CameraSetup (cam1, cam2, true, true);
// Debug.Log("CrossFadePro() begun");
yield return StartCoroutine( AlphaTimer( time ) );
// Debug.Log("CrossFadePro() finished");
cam1.targetTexture = null;
renderTex.Release();
CameraCleanup (cam1, cam2);
}
IEnumerator CrossFade ( Camera cam1, Camera cam2, float time )
{
yield return CrossFade( cam1, cam2, time, null );
}
public IEnumerator CrossFade ( Camera cam1, Camera cam2, float time, AnimationCurve _curve )
{
curve = _curve;
useCurve = curve != null;
if (!tex2D)
{
tex2D = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, false);
}
tex2D.ReadPixels( new Rect(0, 0, Screen.width, Screen.height), 0, 0, false);
tex2D.Apply();
tex = tex2D;
yield return 0;
CameraSetup (cam1, cam2, false, true);
yield return AlphaTimer(time);
CameraCleanup (cam1, cam2);
}
IEnumerator RectWipe ( Camera cam1 , Camera cam2 , float time , ZoomType zoom )
{
yield return RectWipe( cam1, cam2, time, zoom, null );
}
public IEnumerator RectWipe ( Camera cam1 , Camera cam2 , float time , ZoomType zoom , AnimationCurve _curve )
{
curve = _curve;
useCurve = curve != null;
CameraSetup (cam1, cam2, true, false);
Camera useCam = (zoom == ZoomType.Shrink)? cam1 : cam2;
Camera otherCam = (zoom == ZoomType.Shrink)? cam2 : cam1;
Rect originalRect = useCam.rect;
float originalDepth = useCam.depth;
useCam.depth = otherCam.depth+1;
if( useCurve )
{
float rate= 1.0f/(time);
if (zoom == ZoomType.Shrink)
{
for (float i = 0.0f; i < 1.0f; i += Time.deltaTime * rate) {
float t = curve.Evaluate( i )*0.5f;
cam1.rect = new Rect(t, t, 1.0f-t*2, 1.0f-t*2);
yield return 0;
}
}
else
{
for (float i = 0.0f; i < 1.0f; i += Time.deltaTime * rate) {
float t = curve.Evaluate( i )*0.5f;
cam2.rect = new Rect(.5f - t, .5f - t, t * 2.0f, t * 2.0f);
yield return 0;
}
}
}
else
{
float rate = 1.0f/(time*2);
if (zoom == ZoomType.Shrink)
{
for (float i = 0.0f; i < .5; i += Time.deltaTime * rate)
{
float t = Mathf.Lerp(0.0f, .5f, Mathf.Sin(i * Mathf.PI)); // Slow down near the end
cam1.rect = new Rect(t, t, 1.0f-t*2, 1.0f-t*2);
yield return 0;
}
}
else
{
for (float i = 0.0f; i < .5f; i += Time.deltaTime * rate)
{
float t = Mathf.Lerp(.5f, 0.0f, Mathf.Sin((.5f-i) * Mathf.PI)); // Start out slower
cam2.rect = new Rect(.5f-t, .5f-t, t*2.0f, t*2.0f);
yield return 0;
}
}
}
useCam.rect = originalRect;
useCam.depth = originalDepth;
CameraCleanup (cam1, cam2);
}
IEnumerator ShapeWipe ( Camera cam1 , Camera cam2 , float time , ZoomType zoom , Mesh mesh , float rotateAmount )
{
yield return ShapeWipe( cam1, cam2, time, zoom, mesh, rotateAmount, null );
}
public IEnumerator ShapeWipe ( Camera cam1 , Camera cam2 , float time , ZoomType zoom , Mesh mesh , float rotateAmount , AnimationCurve _curve )
{
curve = _curve;
useCurve = curve != null;
if (!shapeMaterial)
{
shapeMaterial = new Material (
"Shader \"DepthMask\" {" +
" SubShader {" +
" Tags { \"Queue\" = \"Background\" }" +
" Lighting Off ZTest LEqual ZWrite On Cull Off ColorMask 0" +
" Pass {}" +
" }" +
"}"
);
}
if (!shape)
{
GameObject gobjShape = new GameObject("Shape");
gobjShape.AddComponent<MeshFilter>();
gobjShape.AddComponent<MeshRenderer>();
shape = gobjShape.transform;
shape.GetComponent<Renderer>().material = shapeMaterial;
}
CameraSetup (cam1, cam2, true, false);
Camera useCam = (zoom == ZoomType.Shrink)? cam1 : cam2;
Camera otherCam = (zoom == ZoomType.Shrink)? cam2 : cam1;
float originalDepth = otherCam.depth;
CameraClearFlags originalClearFlags = otherCam.clearFlags;
otherCam.depth = useCam.depth+1;
otherCam.clearFlags = CameraClearFlags.Depth;
shape.gameObject.active = true;
(shape.GetComponent<MeshFilter>() as MeshFilter).mesh = mesh;
shape.position = otherCam.transform.position + otherCam.transform.forward * (otherCam.nearClipPlane+.01f);
shape.parent = otherCam.transform;
shape.localRotation = Quaternion.identity;
if( useCurve )
{
float rate = 1.0f/time;
if (zoom == ZoomType.Shrink)
{
for (float i = 1.0f; i > 0.0f; i -= Time.deltaTime * rate)
{
float t = curve.Evaluate( i );
shape.localScale = new Vector3(t, t, t);
shape.localEulerAngles = new Vector3(0.0f, 0.0f, i * rotateAmount);
yield return 0;
}
}
else
{
for (float i = 0.0f; i < 1.0f; i += Time.deltaTime * rate)
{
float t = curve.Evaluate( i );
shape.localScale = new Vector3(t, t, t);
shape.localEulerAngles = new Vector3(0.0f, 0.0f, -i * rotateAmount);
yield return 0;
}
}
}
else{
float rate = 1.0f/time;
if (zoom == ZoomType.Shrink) {
for (float i = 1.0f; i > 0.0f; i -= Time.deltaTime * rate) {
float t = Mathf.Lerp(1.0f, 0.0f, Mathf.Sin((1.0f-i) * Mathf.PI * 0.5f)); // Slow down near the end
shape.localScale = new Vector3(t, t, t);
shape.localEulerAngles = new Vector3(0.0f, 0.0f, i * rotateAmount);
yield return 0;
}
}
else {
for (float i = 0.0f; i < 1.0f; i += Time.deltaTime * rate) {
float t = Mathf.Lerp(1.0f, 0.0f, Mathf.Sin((1.0f-i) * Mathf.PI * 0.5f)); // Start out slower
shape.localScale = new Vector3(t, t, t);
shape.localEulerAngles = new Vector3(0.0f, 0.0f, -i * rotateAmount);
yield return 0;
}
}
}
otherCam.clearFlags = originalClearFlags;
otherCam.depth = originalDepth;
CameraCleanup (cam1, cam2);
shape.parent = null;
shape.gameObject.active = false;
}
IEnumerator SquishWipe ( Camera cam1 , Camera cam2 , float time , TransitionType transitionType )
{
yield return SquishWipe( cam1, cam2, time, transitionType, null );
}
public IEnumerator SquishWipe ( Camera cam1 , Camera cam2 , float time , TransitionType transitionType , AnimationCurve _curve )
{
curve = _curve;
useCurve = curve != null;
Rect originalCam1Rect = cam1.rect;
Rect originalCam2Rect = cam2.rect;
Matrix4x4 cam1Matrix = cam1.projectionMatrix;
Matrix4x4 cam2Matrix = cam2.projectionMatrix;
CameraSetup (cam1, cam2, true, false);
float rate = 1.0f/time;
float t = 0.0f;
float i = 0.0f;
while( i < 1.0f )
{
if( useCurve )
{
i = curve.Evaluate(t);
t += Time.deltaTime * rate;
}
else
{
i += Time.deltaTime * rate;
}
switch (transitionType)
{
case TransitionType.Right:
cam1.rect = new Rect(i, 0, 1.0f, 1.0f);
cam2.rect = new Rect(0, 0, i, 1.0f);
break;
case TransitionType.Left:
cam1.rect = new Rect(0, 0, 1.0f-i, 1.0f);
cam2.rect = new Rect(1.0f-i, 0, 1.0f, 1.0f);
break;
case TransitionType.Up:
cam1.rect = new Rect(0, i, 1.0f, 1.0f);
cam2.rect = new Rect(0, 0, 1.0f, i);
break;
case TransitionType.Down:
cam1.rect = new Rect(0, 0, 1.0f, 1.0f-i);
cam2.rect = new Rect(0, 1.0f-i, 1.0f, 1.0f);
break;
}
cam1.projectionMatrix = cam1Matrix;
cam2.projectionMatrix = cam2Matrix;
yield return 0;
}
cam1.rect = originalCam1Rect;
cam2.rect = originalCam2Rect;
CameraCleanup (cam1, cam2);
}
public int planeResolution = 90; // Higher numbers make the DreamWipe effect smoother, but take more CPU time
private Vector3[] baseVertices;
private Vector3[] newVertices;
private Material planeMaterial;
private GameObject plane;
private RenderTexture renderTex2;
public void InitializeDreamWipe ()
{
if (planeMaterial && plane) return;
Debug.Log("InitializeDreamWipe here!");
planeMaterial = new Material
(
"Shader \"Unlit2Pass\" {" +
"Properties {" +
" _Color (\"Main Color\", Color) = (1,1,1,1)" +
" _Tex1 (\"Base\", Rect) = \"white\" {}" +
" _Tex2 (\"Base\", Rect) = \"white\" {}" +
"}" +
"Category {" +
" ZWrite Off Alphatest Greater 0 ColorMask RGB Lighting Off" +
" Tags {\"Queue\"=\"Transparent\" \"IgnoreProjector\"=\"True\" \"RenderType\"=\"Transparent\"}" +
" Blend SrcAlpha OneMinusSrcAlpha" +
" SubShader {" +
" Pass {SetTexture [_Tex2]}" +
" Pass {SetTexture [_Tex1] {constantColor [_Color] Combine texture * constant, texture * constant}}" +
" }" +
"}}"
);
// Set up plane object
plane = new GameObject("Plane");
plane.AddComponent<MeshFilter>();
plane.AddComponent<MeshRenderer>();
plane.GetComponent<Renderer>().material = planeMaterial;
plane.GetComponent<Renderer>().castShadows = false;
plane.GetComponent<Renderer>().receiveShadows = false;
plane.GetComponent<Renderer>().enabled = false;
// Create the mesh used for the distortion effect
Mesh planeMesh = new Mesh();
(plane.GetComponent<MeshFilter>() as MeshFilter).mesh = planeMesh;
planeResolution = Mathf.Clamp(planeResolution, 1, 16380);
baseVertices = new Vector3[4*planeResolution + 4];
newVertices = new Vector3[baseVertices.Length];
Vector2[] newUV = new Vector2[baseVertices.Length];
int[] newTriangles = new int[18*planeResolution];
int idx = 0;
for (int i = 0; i <= planeResolution; i++)
{
float add = 1.0f/planeResolution*i;
newUV[idx] = new Vector2(0.0f, 1.0f-add);
baseVertices[idx++] = new Vector3(-1.0f, .5f-add, 0.0f);
newUV[idx] = new Vector2(0.0f, 1.0f-add);
baseVertices[idx++] = new Vector3(-.5f, .5f-add, 0.0f);
newUV[idx] = new Vector2(1.0f, 1.0f-add);
baseVertices[idx++] = new Vector3(.5f, .5f-add, 0.0f);
newUV[idx] = new Vector2(1.0f, 1.0f-add);
baseVertices[idx++] = new Vector3(1.0f, .5f-add, 0.0f);
}
idx = 0;
for (int y = 0; y < planeResolution; y++)
{
for (int x = 0; x < 3; x++) {
newTriangles[idx++] = (y*4 )+x;
newTriangles[idx++] = (y*4 )+x+1;
newTriangles[idx++] = ((y+1)*4)+x;
newTriangles[idx++] = ((y+1)*4)+x;
newTriangles[idx++] = (y *4)+x+1;
newTriangles[idx++] = ((y+1)*4)+x+1;
}
}
planeMesh.vertices = baseVertices;
planeMesh.uv = newUV;
planeMesh.triangles = newTriangles;
// Set up rendertextures
renderTex = new RenderTexture(Screen.width, Screen.height, 24);
renderTex2 = new RenderTexture(Screen.width, Screen.height, 24);
renderTex.filterMode = renderTex2.filterMode = FilterMode.Point;
planeMaterial.SetTexture("_Tex1", renderTex);
planeMaterial.SetTexture("_Tex2", renderTex2);
}
// IEnumerator DreamWipe ( Camera cam1 , Camera cam2 , float time )
// {
// yield return DreamWipe (cam1, cam2, time, .07f, 25.0f);
// }
public IEnumerator DreamWipe ( Camera cam1, Camera cam2, float time, float waveScale, float waveFrequency )
{
if (!plane)
{
InitializeDreamWipe();
}
waveScale = Mathf.Clamp(waveScale, -.5f, .5f);
waveFrequency = .25f/(planeResolution/waveFrequency);
CameraSetup (cam1, cam2, true, false);
Debug.Log("DreamWipe() begun");
// Make a camera that will show a plane with the combined rendertextures from cam1 and cam2,
// and make it have the highest depth so it's always on top
Camera cam2Clone = Instantiate(cam2, cam2.transform.position, cam2.transform.rotation) as Camera;
cam2Clone.depth = cam1.depth+1;
if (cam2Clone.depth <= cam2.depth)
{
cam2Clone.depth = cam2.depth+1;
}
// Get screen coodinates of 0,0 in local spatial coordinates, so we know how big to scale the plane (make sure clip planes are reasonable)
cam2Clone.nearClipPlane = .5f;
cam2Clone.farClipPlane = 1.0f;
Vector3 p = cam2Clone.transform.InverseTransformPoint(cam2.ScreenToWorldPoint(new Vector3(0.0f, 0.0f, cam2Clone.nearClipPlane)));
plane.transform.localScale = new Vector3(-p.x*2.0f, -p.y*2.0f, 1.0f);
plane.transform.parent = cam2Clone.transform;
plane.transform.localPosition = plane.transform.localEulerAngles = Vector3.zero;
// Must be a tiny bit beyond the nearClipPlane, or it might not show up
plane.transform.Translate(Vector3.forward * (cam2Clone.nearClipPlane+.00005f));
// Move the camera back so cam2 won't see the renderPlane, and parent it to cam2 so that if cam2 is moving, it won't see the plane
cam2Clone.transform.Translate(Vector3.forward * -1.0f);
cam2Clone.transform.parent = cam2.transform;
// Initialize some stuff
plane.GetComponent<Renderer>().enabled = true;
float scale = 0.0f;
Mesh planeMesh = plane.GetComponent<MeshFilter>().mesh;
cam1.targetTexture = renderTex;
cam2.targetTexture = renderTex2;
// Do the cross-fade
float rate = 1.0f/time;
for (float i = 0.0f; i < 1.0f; i += Time.deltaTime * rate)
{
planeMaterial.color = new Color( planeMaterial.color.r, planeMaterial.color.g, planeMaterial.color.b, Mathf.SmoothStep(0.0f, 1.0f, Mathf.InverseLerp(.75f, .15f, i)));
// Make plane undulate
for (int j = 0; j < newVertices.Length; j++) {
newVertices[j] = baseVertices[j];
newVertices[j].x += Mathf.Sin(j*waveFrequency + i*time) * scale;
}
planeMesh.vertices = newVertices;
scale = Mathf.Sin(Mathf.PI * Mathf.SmoothStep(0.0f, 1.0f, i)) * waveScale;
yield return 0;
}
Debug.Log("DreamWipe() finished");
// Clean up
CameraCleanup (cam1, cam2);
plane.GetComponent<Renderer>().enabled = false;
plane.transform.parent = null;
Destroy(cam2Clone.gameObject);
cam1.targetTexture = cam2.targetTexture = null;
renderTex.Release();
renderTex2.Release();
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 20b0d142b2e4ecc46b1c96c8d854966f
timeCreated: 1463571660
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
BIN
View File
Binary file not shown.
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 68ed6ef687ac9e145aea492726825dec
timeCreated: 1463533063
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
+51
View File
@@ -0,0 +1,51 @@
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class TextureTilingController : MonoBehaviour
{
// Give us the texture so that we can scale proportianally the width according to the height variable below
// We will grab it from the meshRenderer
public Texture texture;
public float textureToMeshZ = 2f; // Use this to contrain texture to a certain size
Vector3 prevScale = Vector3.one;
float prevTextureToMeshZ = -1f;
// Use this for initialization
void Start()
{
this.prevScale = gameObject.transform.lossyScale;
this.prevTextureToMeshZ = this.textureToMeshZ;
this.UpdateTiling();
}
// Update is called once per frame
void Update()
{
// If something has changed
if (gameObject.transform.lossyScale != prevScale || !Mathf.Approximately(this.textureToMeshZ, prevTextureToMeshZ))
this.UpdateTiling();
// Maintain previous state variables
this.prevScale = gameObject.transform.lossyScale;
this.prevTextureToMeshZ = this.textureToMeshZ;
}
[ContextMenu("UpdateTiling")]
void UpdateTiling()
{
// A Unity plane is 10 units x 10 units
float planeSizeX = 1f;
float planeSizeZ = 1f;
// Figure out texture-to-mesh width based on user set texture-to-mesh height
float textureToMeshX = ((float)this.texture.width / this.texture.height) * this.textureToMeshZ;
var textureScale = new Vector2(planeSizeX * gameObject.transform.lossyScale.x / textureToMeshX, planeSizeZ * gameObject.transform.lossyScale.z / textureToMeshZ);
gameObject.GetComponent<Renderer>().material.SetTextureScale("_MainTex", textureScale);
gameObject.GetComponent<Renderer>().material.SetTextureScale("_BumpMap", textureScale);
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 05e56aa9d0b259943a4b6ee94fb1b01b
timeCreated: 1463540636
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+39
View File
@@ -0,0 +1,39 @@
using UnityEngine;
using System.Collections;
public class ViewFrustrumTrigger : MonoBehaviour {
public Camera Camera;
public delegate void ViewFrustrumEventHandler();
public event ViewFrustrumEventHandler EnterView;
public event ViewFrustrumEventHandler LeaveView;
private bool visible = false;
void Update () {
Bounds bounds;
var renderer = GetComponentInChildren<Renderer>();
if (renderer) {
bounds = renderer.bounds;
} else {
return;
}
if (visible && !IsVisibleFrom(bounds, Camera)) {
if (LeaveView != null) {
LeaveView();
}
visible = false;
} else if (!visible && IsVisibleFrom(bounds, Camera)) {
if (EnterView != null) {
EnterView();
}
visible = true;
}
}
static bool IsVisibleFrom(Bounds bounds, Camera camera) {
Plane[] planes = GeometryUtility.CalculateFrustumPlanes(camera);
return GeometryUtility.TestPlanesAABB(planes, bounds);
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7d423ad8c084668499c7bcecb9ec826c
timeCreated: 1463580394
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
BIN
View File
Binary file not shown.
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8ebf22875ea5fb049ac77142db75e2e4
timeCreated: 1463570167
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
+17
View File
@@ -0,0 +1,17 @@
using UnityEngine;
using System.Collections;
public class WarehouseController {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update() {
}
}
+12
View File
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 0384ed48f2917aa448f441488dacd81a
timeCreated: 1463577325
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
BIN
View File
Binary file not shown.
+77
View File
@@ -0,0 +1,77 @@
fileFormatVersion: 2
guid: c5d3c14fb3412754a8c37a3e45fea659
timeCreated: 1463581838
licenseType: Free
ModelImporter:
serializedVersion: 19
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2300000: //RootNode
3300000: //RootNode
4300000: lasse
9500000: //RootNode
materials:
importMaterials: 1
materialName: 0
materialSearch: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleRotations: 1
optimizeGameObjects: 0
motionNodeName:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
clipAnimations: []
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
importBlendShapes: 1
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
optimizeMeshForGPU: 1
keepQuads: 0
weldVertices: 1
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
importAnimation: 1
copyAvatar: 0
humanDescription:
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
rootMotionBoneName:
hasTranslationDoF: 0
lastHumanDescriptionAvatarSource: {instanceID: 0}
animationType: 2
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 46 MiB

+57
View File
@@ -0,0 +1,57 @@
fileFormatVersion: 2
guid: 6a329c6c386d4994d8eb9a05534ed2fc
timeCreated: 1463581904
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
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+2
View File
@@ -0,0 +1,2 @@
m_EditorVersion: 5.3.4f1
m_StandardAssetsVersion: 0
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.