diff --git a/Assets/EditorMat.mat b/Assets/EditorMat.mat new file mode 100755 index 0000000..dc0cf4d --- /dev/null +++ b/Assets/EditorMat.mat @@ -0,0 +1,76 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: EditorMat + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/EditorMat.mat b/Assets/EditorMat.mat new file mode 100755 index 0000000..dc0cf4d --- /dev/null +++ b/Assets/EditorMat.mat @@ -0,0 +1,76 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: EditorMat + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/EditorMat.mat.meta b/Assets/EditorMat.mat.meta new file mode 100755 index 0000000..e5c2151 --- /dev/null +++ b/Assets/EditorMat.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e5545830075b9604394f8a2c52b53b43 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/EditorMat.mat b/Assets/EditorMat.mat new file mode 100755 index 0000000..dc0cf4d --- /dev/null +++ b/Assets/EditorMat.mat @@ -0,0 +1,76 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: EditorMat + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/EditorMat.mat.meta b/Assets/EditorMat.mat.meta new file mode 100755 index 0000000..e5c2151 --- /dev/null +++ b/Assets/EditorMat.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e5545830075b9604394f8a2c52b53b43 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/IsoEditor.cs b/Assets/IsoEditor.cs index 2249271..2cea357 100755 --- a/Assets/IsoEditor.cs +++ b/Assets/IsoEditor.cs @@ -23,28 +23,22 @@ } private bool isoMode = false; + public bool IsoMode { get { return isoMode; } } private Vector3 lastCameraP; private Quaternion lastCameraQ; private bool lastOrtho; public void EnableButtons() { - if (!hasEvents) - { - hasEvents = true; - SceneView.onSceneGUIDelegate += OnSceneGUI; - SceneView.RepaintAll(); - } + SceneView.onSceneGUIDelegate -= OnSceneGUI; + SceneView.onSceneGUIDelegate += OnSceneGUI; + SceneView.RepaintAll(); } public void DisableButtons() { - if (hasEvents) - { - hasEvents = false; - SceneView.onSceneGUIDelegate -= OnSceneGUI; - SceneView.RepaintAll(); - } + SceneView.onSceneGUIDelegate -= OnSceneGUI; + SceneView.RepaintAll(); } public void OnSceneGUI(SceneView sceneView) diff --git a/Assets/EditorMat.mat b/Assets/EditorMat.mat new file mode 100755 index 0000000..dc0cf4d --- /dev/null +++ b/Assets/EditorMat.mat @@ -0,0 +1,76 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: EditorMat + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/EditorMat.mat.meta b/Assets/EditorMat.mat.meta new file mode 100755 index 0000000..e5c2151 --- /dev/null +++ b/Assets/EditorMat.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e5545830075b9604394f8a2c52b53b43 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/IsoEditor.cs b/Assets/IsoEditor.cs index 2249271..2cea357 100755 --- a/Assets/IsoEditor.cs +++ b/Assets/IsoEditor.cs @@ -23,28 +23,22 @@ } private bool isoMode = false; + public bool IsoMode { get { return isoMode; } } private Vector3 lastCameraP; private Quaternion lastCameraQ; private bool lastOrtho; public void EnableButtons() { - if (!hasEvents) - { - hasEvents = true; - SceneView.onSceneGUIDelegate += OnSceneGUI; - SceneView.RepaintAll(); - } + SceneView.onSceneGUIDelegate -= OnSceneGUI; + SceneView.onSceneGUIDelegate += OnSceneGUI; + SceneView.RepaintAll(); } public void DisableButtons() { - if (hasEvents) - { - hasEvents = false; - SceneView.onSceneGUIDelegate -= OnSceneGUI; - SceneView.RepaintAll(); - } + SceneView.onSceneGUIDelegate -= OnSceneGUI; + SceneView.RepaintAll(); } public void OnSceneGUI(SceneView sceneView) diff --git a/Assets/IsoObject.cs b/Assets/IsoObject.cs index 3fa158d..86ecd64 100755 --- a/Assets/IsoObject.cs +++ b/Assets/IsoObject.cs @@ -1,28 +1,41 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; using UnityEngine; [ExecuteInEditMode] public class IsoObject : MonoBehaviour { - public Camera IsoCamera; public List IsoMeshes; - // Use this for initialization - void Start () { - - } - - // Update is called once per frame - void Update () { - - } - - void LateUpdate() + + private IsoEditor isoEditor; + + private void OnEnable() { - Vector3 viewPos = IsoCamera.WorldToViewportPoint(gameObject.transform.position); - foreach (MeshRenderer mr in IsoMeshes) + isoEditor = FindObjectOfType(); + Camera.onPreRender += PreRender; + } + + private void PreRender(Camera cam) + { + //Debug.Log(cam.GetInstanceID()); + if (cam.orthographic && isoEditor.IsoMode) { - mr.material.SetVector("_CenterPoint", new Vector4(viewPos.x, viewPos.y)); + Vector3 viewPos = cam.WorldToViewportPoint(gameObject.transform.position); + foreach (MeshRenderer mr in IsoMeshes) + { + mr.sharedMaterial.SetVector("_CenterPoint", new Vector4(viewPos.x, viewPos.y)); + } } } + + private void OnDisable() + { + Camera.onPreRender -= PreRender; + } + + // Update is called once per frame + void Update () { + + } } diff --git a/Assets/EditorMat.mat b/Assets/EditorMat.mat new file mode 100755 index 0000000..dc0cf4d --- /dev/null +++ b/Assets/EditorMat.mat @@ -0,0 +1,76 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: EditorMat + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/EditorMat.mat.meta b/Assets/EditorMat.mat.meta new file mode 100755 index 0000000..e5c2151 --- /dev/null +++ b/Assets/EditorMat.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e5545830075b9604394f8a2c52b53b43 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/IsoEditor.cs b/Assets/IsoEditor.cs index 2249271..2cea357 100755 --- a/Assets/IsoEditor.cs +++ b/Assets/IsoEditor.cs @@ -23,28 +23,22 @@ } private bool isoMode = false; + public bool IsoMode { get { return isoMode; } } private Vector3 lastCameraP; private Quaternion lastCameraQ; private bool lastOrtho; public void EnableButtons() { - if (!hasEvents) - { - hasEvents = true; - SceneView.onSceneGUIDelegate += OnSceneGUI; - SceneView.RepaintAll(); - } + SceneView.onSceneGUIDelegate -= OnSceneGUI; + SceneView.onSceneGUIDelegate += OnSceneGUI; + SceneView.RepaintAll(); } public void DisableButtons() { - if (hasEvents) - { - hasEvents = false; - SceneView.onSceneGUIDelegate -= OnSceneGUI; - SceneView.RepaintAll(); - } + SceneView.onSceneGUIDelegate -= OnSceneGUI; + SceneView.RepaintAll(); } public void OnSceneGUI(SceneView sceneView) diff --git a/Assets/IsoObject.cs b/Assets/IsoObject.cs index 3fa158d..86ecd64 100755 --- a/Assets/IsoObject.cs +++ b/Assets/IsoObject.cs @@ -1,28 +1,41 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; using UnityEngine; [ExecuteInEditMode] public class IsoObject : MonoBehaviour { - public Camera IsoCamera; public List IsoMeshes; - // Use this for initialization - void Start () { - - } - - // Update is called once per frame - void Update () { - - } - - void LateUpdate() + + private IsoEditor isoEditor; + + private void OnEnable() { - Vector3 viewPos = IsoCamera.WorldToViewportPoint(gameObject.transform.position); - foreach (MeshRenderer mr in IsoMeshes) + isoEditor = FindObjectOfType(); + Camera.onPreRender += PreRender; + } + + private void PreRender(Camera cam) + { + //Debug.Log(cam.GetInstanceID()); + if (cam.orthographic && isoEditor.IsoMode) { - mr.material.SetVector("_CenterPoint", new Vector4(viewPos.x, viewPos.y)); + Vector3 viewPos = cam.WorldToViewportPoint(gameObject.transform.position); + foreach (MeshRenderer mr in IsoMeshes) + { + mr.sharedMaterial.SetVector("_CenterPoint", new Vector4(viewPos.x, viewPos.y)); + } } } + + private void OnDisable() + { + Camera.onPreRender -= PreRender; + } + + // Update is called once per frame + void Update () { + + } } diff --git a/Assets/Textures/House_FallingLeaves.png.meta b/Assets/Textures/House_FallingLeaves.png.meta index b864809..f454001 100755 --- a/Assets/Textures/House_FallingLeaves.png.meta +++ b/Assets/Textures/House_FallingLeaves.png.meta @@ -32,9 +32,9 @@ filterMode: -1 aniso: -1 mipBias: -1 - wrapU: -1 - wrapV: -1 - wrapW: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 nPOTScale: 1 lightmap: 0 compressionQuality: 50 @@ -65,6 +65,36 @@ allowsAlphaSplitting: 0 overridden: 0 androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 spriteSheet: serializedVersion: 2 sprites: [] diff --git a/Assets/EditorMat.mat b/Assets/EditorMat.mat new file mode 100755 index 0000000..dc0cf4d --- /dev/null +++ b/Assets/EditorMat.mat @@ -0,0 +1,76 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!21 &2100000 +Material: + serializedVersion: 6 + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_Name: EditorMat + m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0} + m_ShaderKeywords: + m_LightmapFlags: 4 + m_EnableInstancingVariants: 0 + m_DoubleSidedGI: 0 + m_CustomRenderQueue: -1 + stringTagMap: {} + disabledShaderPasses: [] + m_SavedProperties: + serializedVersion: 3 + m_TexEnvs: + - _BumpMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailAlbedoMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailMask: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _DetailNormalMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _EmissionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MainTex: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _MetallicGlossMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _OcclusionMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + - _ParallaxMap: + m_Texture: {fileID: 0} + m_Scale: {x: 1, y: 1} + m_Offset: {x: 0, y: 0} + m_Floats: + - _BumpScale: 1 + - _Cutoff: 0.5 + - _DetailNormalMapScale: 1 + - _DstBlend: 0 + - _GlossMapScale: 1 + - _Glossiness: 0.5 + - _GlossyReflections: 1 + - _Metallic: 0 + - _Mode: 0 + - _OcclusionStrength: 1 + - _Parallax: 0.02 + - _SmoothnessTextureChannel: 0 + - _SpecularHighlights: 1 + - _SrcBlend: 1 + - _UVSec: 0 + - _ZWrite: 1 + m_Colors: + - _Color: {r: 1, g: 1, b: 1, a: 1} + - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} diff --git a/Assets/EditorMat.mat.meta b/Assets/EditorMat.mat.meta new file mode 100755 index 0000000..e5c2151 --- /dev/null +++ b/Assets/EditorMat.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: e5545830075b9604394f8a2c52b53b43 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/IsoEditor.cs b/Assets/IsoEditor.cs index 2249271..2cea357 100755 --- a/Assets/IsoEditor.cs +++ b/Assets/IsoEditor.cs @@ -23,28 +23,22 @@ } private bool isoMode = false; + public bool IsoMode { get { return isoMode; } } private Vector3 lastCameraP; private Quaternion lastCameraQ; private bool lastOrtho; public void EnableButtons() { - if (!hasEvents) - { - hasEvents = true; - SceneView.onSceneGUIDelegate += OnSceneGUI; - SceneView.RepaintAll(); - } + SceneView.onSceneGUIDelegate -= OnSceneGUI; + SceneView.onSceneGUIDelegate += OnSceneGUI; + SceneView.RepaintAll(); } public void DisableButtons() { - if (hasEvents) - { - hasEvents = false; - SceneView.onSceneGUIDelegate -= OnSceneGUI; - SceneView.RepaintAll(); - } + SceneView.onSceneGUIDelegate -= OnSceneGUI; + SceneView.RepaintAll(); } public void OnSceneGUI(SceneView sceneView) diff --git a/Assets/IsoObject.cs b/Assets/IsoObject.cs index 3fa158d..86ecd64 100755 --- a/Assets/IsoObject.cs +++ b/Assets/IsoObject.cs @@ -1,28 +1,41 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; using UnityEngine; [ExecuteInEditMode] public class IsoObject : MonoBehaviour { - public Camera IsoCamera; public List IsoMeshes; - // Use this for initialization - void Start () { - - } - - // Update is called once per frame - void Update () { - - } - - void LateUpdate() + + private IsoEditor isoEditor; + + private void OnEnable() { - Vector3 viewPos = IsoCamera.WorldToViewportPoint(gameObject.transform.position); - foreach (MeshRenderer mr in IsoMeshes) + isoEditor = FindObjectOfType(); + Camera.onPreRender += PreRender; + } + + private void PreRender(Camera cam) + { + //Debug.Log(cam.GetInstanceID()); + if (cam.orthographic && isoEditor.IsoMode) { - mr.material.SetVector("_CenterPoint", new Vector4(viewPos.x, viewPos.y)); + Vector3 viewPos = cam.WorldToViewportPoint(gameObject.transform.position); + foreach (MeshRenderer mr in IsoMeshes) + { + mr.sharedMaterial.SetVector("_CenterPoint", new Vector4(viewPos.x, viewPos.y)); + } } } + + private void OnDisable() + { + Camera.onPreRender -= PreRender; + } + + // Update is called once per frame + void Update () { + + } } diff --git a/Assets/Textures/House_FallingLeaves.png.meta b/Assets/Textures/House_FallingLeaves.png.meta index b864809..f454001 100755 --- a/Assets/Textures/House_FallingLeaves.png.meta +++ b/Assets/Textures/House_FallingLeaves.png.meta @@ -32,9 +32,9 @@ filterMode: -1 aniso: -1 mipBias: -1 - wrapU: -1 - wrapV: -1 - wrapW: -1 + wrapU: 1 + wrapV: 1 + wrapW: 1 nPOTScale: 1 lightmap: 0 compressionQuality: 50 @@ -65,6 +65,36 @@ allowsAlphaSplitting: 0 overridden: 0 androidETC2FallbackOverride: 0 + - buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: Android + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + - buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 spriteSheet: serializedVersion: 2 sprites: [] diff --git a/Assets/main.unity b/Assets/main.unity index 4d38d18..a1f1390 100755 --- a/Assets/main.unity +++ b/Assets/main.unity @@ -145,7 +145,7 @@ m_LightProbeUsage: 1 m_ReflectionProbeUsage: 1 m_Materials: - - {fileID: 1639333834} + - {fileID: 1424158291} m_StaticBatchInfo: firstSubMesh: 0 subMeshCount: 0 @@ -373,48 +373,7 @@ m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 24, y: 0, z: 0} ---- !u!1 &1493590970 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 5 - m_Component: - - component: {fileID: 1493590972} - - component: {fileID: 1493590971} - m_Layer: 0 - m_Name: IsoEditor - m_TagString: EditorOnly - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1493590971 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1493590970} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8b78fba809e013444851b9c5e8b697ec, type: 3} - m_Name: - m_EditorClassIdentifier: - IsoCamera: {fileID: 1211379095} ---- !u!4 &1493590972 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 1493590970} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: -0.21005154, y: 0.230649, z: 0.058857918} - m_LocalScale: {x: 1, y: 1, z: 1} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 4 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!21 &1639333834 +--- !u!21 &1424158291 Material: serializedVersion: 6 m_ObjectHideFlags: 0 @@ -490,7 +449,48 @@ - _CenterPoint: {r: 0.5, g: 0.2493228, b: 0, a: 0} - _Color: {r: 1, g: 1, b: 1, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - - _TextureOffset: {r: -215, g: -628, b: 0, a: 0} + - _TextureOffset: {r: 0, g: 0, b: 0, a: 0} +--- !u!1 &1493590970 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 1493590972} + - component: {fileID: 1493590971} + m_Layer: 0 + m_Name: IsoEditor + m_TagString: EditorOnly + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1493590971 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1493590970} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 8b78fba809e013444851b9c5e8b697ec, type: 3} + m_Name: + m_EditorClassIdentifier: + IsoCamera: {fileID: 1211379095} +--- !u!4 &1493590972 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1493590970} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: -0.21005154, y: 0.230649, z: 0.058857918} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 4 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &1646089003 GameObject: m_ObjectHideFlags: 0