Commit b259bd57 authored by Nathan De Castro's avatar Nathan De Castro

WORKING_RIPPLE

parent e62bb15d
...@@ -49,6 +49,7 @@ ...@@ -49,6 +49,7 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Assets\Editor\CreatePlane.cs" />
<Compile Include="Assets\Editor\CrossPlatformInput\CrossPlatformInputInitialize.cs" /> <Compile Include="Assets\Editor\CrossPlatformInput\CrossPlatformInputInitialize.cs" />
<None Include="Assets\Materials\Monster\shaders\vertexAnim.shader" /> <None Include="Assets\Materials\Monster\shaders\vertexAnim.shader" />
<None Include="Assets\Materials\Monster\shaders\bumpSpecmap.shader" /> <None Include="Assets\Materials\Monster\shaders\bumpSpecmap.shader" />
......
This diff is collapsed.
fileFormatVersion: 2 fileFormatVersion: 2
guid: 810cebed1f363c7479884f152d71de71 guid: 4a74b92bb206b854b8957378b6961fb5
timeCreated: 1486916812 timeCreated: 1487090462
licenseType: Free licenseType: Free
NativeFormatImporter: NativeFormatImporter:
userData: userData:
......
using UnityEngine;
using UnityEditor;
public class CreatePlane : ScriptableWizard
{
public enum Orientation
{
Horizontal,
Vertical
}
public enum AnchorPoint
{
TopLeft,
TopHalf,
TopRight,
RightHalf,
BottomRight,
BottomHalf,
BottomLeft,
LeftHalf,
Center
}
public int widthSegments = 1;
public int lengthSegments = 1;
public float width = 1.0f;
public float length = 1.0f;
public Orientation orientation = Orientation.Horizontal;
public AnchorPoint anchor = AnchorPoint.Center;
public bool addCollider = false;
public bool createAtOrigin = true;
public bool twoSided = false;
public string optionalName;
static Camera cam;
static Camera lastUsedCam;
[MenuItem("GameObject/Create Other/Custom Plane...")]
static void CreateWizard()
{
cam = Camera.current;
// Hack because camera.current doesn't return editor camera if scene view doesn't have focus
if (!cam)
cam = lastUsedCam;
else
lastUsedCam = cam;
ScriptableWizard.DisplayWizard("Create Plane",typeof(CreatePlane));
}
void OnWizardUpdate()
{
widthSegments = Mathf.Clamp(widthSegments, 1, 254);
lengthSegments = Mathf.Clamp(lengthSegments, 1, 254);
}
void OnWizardCreate()
{
GameObject plane = new GameObject();
if (!string.IsNullOrEmpty(optionalName))
plane.name = optionalName;
else
plane.name = "Plane";
if (!createAtOrigin && cam)
plane.transform.position = cam.transform.position + cam.transform.forward*5.0f;
else
plane.transform.position = Vector3.zero;
Vector2 anchorOffset;
string anchorId;
switch (anchor)
{
case AnchorPoint.TopLeft:
anchorOffset = new Vector2(-width/2.0f,length/2.0f);
anchorId = "TL";
break;
case AnchorPoint.TopHalf:
anchorOffset = new Vector2(0.0f,length/2.0f);
anchorId = "TH";
break;
case AnchorPoint.TopRight:
anchorOffset = new Vector2(width/2.0f,length/2.0f);
anchorId = "TR";
break;
case AnchorPoint.RightHalf:
anchorOffset = new Vector2(width/2.0f,0.0f);
anchorId = "RH";
break;
case AnchorPoint.BottomRight:
anchorOffset = new Vector2(width/2.0f,-length/2.0f);
anchorId = "BR";
break;
case AnchorPoint.BottomHalf:
anchorOffset = new Vector2(0.0f,-length/2.0f);
anchorId = "BH";
break;
case AnchorPoint.BottomLeft:
anchorOffset = new Vector2(-width/2.0f,-length/2.0f);
anchorId = "BL";
break;
case AnchorPoint.LeftHalf:
anchorOffset = new Vector2(-width/2.0f,0.0f);
anchorId = "LH";
break;
case AnchorPoint.Center:
default:
anchorOffset = Vector2.zero;
anchorId = "C";
break;
}
MeshFilter meshFilter = (MeshFilter)plane.AddComponent(typeof(MeshFilter));
plane.AddComponent(typeof(MeshRenderer));
string planeAssetName = plane.name + widthSegments + "x" + lengthSegments + "W" + width + "L" + length + (orientation == Orientation.Horizontal? "H" : "V") + anchorId + ".asset";
Mesh m = (Mesh)AssetDatabase.LoadAssetAtPath("Assets/Editor/" + planeAssetName,typeof(Mesh));
if (m == null)
{
m = new Mesh();
m.name = plane.name;
int hCount2 = widthSegments+1;
int vCount2 = lengthSegments+1;
int numTriangles = widthSegments * lengthSegments * 6;
if (twoSided) {
numTriangles *= 2;
}
int numVertices = hCount2 * vCount2;
Vector3[] vertices = new Vector3[numVertices];
Vector2[] uvs = new Vector2[numVertices];
int[] triangles = new int[numTriangles];
Vector4[] tangents = new Vector4[numVertices];
Vector4 tangent = new Vector4(1f, 0f, 0f, -1f);
int index = 0;
float uvFactorX = 1.0f/widthSegments;
float uvFactorY = 1.0f/lengthSegments;
float scaleX = width/widthSegments;
float scaleY = length/lengthSegments;
for (float y = 0.0f; y < vCount2; y++)
{
for (float x = 0.0f; x < hCount2; x++)
{
if (orientation == Orientation.Horizontal)
{
vertices[index] = new Vector3(x*scaleX - width/2f - anchorOffset.x, 0.0f, y*scaleY - length/2f - anchorOffset.y);
}
else
{
vertices[index] = new Vector3(x*scaleX - width/2f - anchorOffset.x, y*scaleY - length/2f - anchorOffset.y, 0.0f);
}
tangents[index] = tangent;
uvs[index++] = new Vector2(x*uvFactorX, y*uvFactorY);
}
}
index = 0;
for (int y = 0; y < lengthSegments; y++)
{
for (int x = 0; x < widthSegments; x++)
{
triangles[index] = (y * hCount2) + x;
triangles[index+1] = ((y+1) * hCount2) + x;
triangles[index+2] = (y * hCount2) + x + 1;
triangles[index+3] = ((y+1) * hCount2) + x;
triangles[index+4] = ((y+1) * hCount2) + x + 1;
triangles[index+5] = (y * hCount2) + x + 1;
index += 6;
}
if (twoSided) {
// Same tri vertices with order reversed, so normals point in the opposite direction
for (int x = 0; x < widthSegments; x++)
{
triangles[index] = (y * hCount2) + x;
triangles[index+1] = (y * hCount2) + x + 1;
triangles[index+2] = ((y+1) * hCount2) + x;
triangles[index+3] = ((y+1) * hCount2) + x;
triangles[index+4] = (y * hCount2) + x + 1;
triangles[index+5] = ((y+1) * hCount2) + x + 1;
index += 6;
}
}
}
m.vertices = vertices;
m.uv = uvs;
m.triangles = triangles;
m.tangents = tangents;
m.RecalculateNormals();
AssetDatabase.CreateAsset(m, "Assets/Editor/" + planeAssetName);
AssetDatabase.SaveAssets();
}
meshFilter.sharedMesh = m;
m.RecalculateBounds();
if (addCollider)
plane.AddComponent(typeof(BoxCollider));
Selection.activeObject = plane;
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: f4f61521c7e2f1f49b146c36ce4ff2e6
timeCreated: 1487090002
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 2e74733e18a0c4a42b808af011b6aacc
timeCreated: 1487090157
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
%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: New Material
m_Shader: {fileID: 28, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
stringTagMap: {}
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
- first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _Cube
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- first:
name: _Cutoff
second: 0.5
- first:
name: _Parallax
second: 0.0132835815
- first:
name: _Shininess
second: 0.56573695
m_Colors:
- first:
name: _Color
second: {r: 0.4, g: 1, b: 1, a: 0.24}
- first:
name: _ReflectColor
second: {r: 1, g: 0.43529412, b: 0.8117647, a: 1}
- first:
name: _SpecColor
second: {r: 0.4, g: 1, b: 0.4, a: 1}
--- !u!1002 &2100001
EditorExtensionImpl:
serializedVersion: 6
...@@ -9,38 +9,34 @@ Prefab: ...@@ -9,38 +9,34 @@ Prefab:
m_Modifications: [] m_Modifications: []
m_RemovedComponents: [] m_RemovedComponents: []
m_ParentPrefab: {fileID: 0} m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1802124651185064} m_RootGameObject: {fileID: 1074163696516364}
m_IsPrefabParent: 1 m_IsPrefabParent: 1
--- !u!1 &1049480624652460 --- !u!1 &1074163696516364
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5 serializedVersion: 5
m_Component: m_Component:
- component: {fileID: 4607767398666284} - component: {fileID: 4893222388098864}
- component: {fileID: 23388984037506834}
- component: {fileID: 111601143508679154}
- component: {fileID: 114240015916630166}
- component: {fileID: 33088446716562156}
m_Layer: 0 m_Layer: 0
m_Name: 128xplane m_Name: RipplePlane
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!1 &1526515523882130 --- !u!1 &1085291655187690
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5 serializedVersion: 5
m_Component: m_Component:
- component: {fileID: 4580214526593280} - component: {fileID: 4403276698753482}
- component: {fileID: 33376699165076374} - component: {fileID: 33437110337189046}
- component: {fileID: 64607807228510372} - component: {fileID: 64071859940178228}
- component: {fileID: 23917298595123638} - component: {fileID: 23495640269871906}
m_Layer: 0 m_Layer: 0
m_Name: collision plane m_Name: collision plane
m_TagString: Untagged m_TagString: Untagged
...@@ -48,76 +44,80 @@ GameObject: ...@@ -48,76 +44,80 @@ GameObject:
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!1 &1802124651185064 --- !u!1 &1492582809623812
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5 serializedVersion: 5
m_Component: m_Component:
- component: {fileID: 4104538227611206} - component: {fileID: 4929360730828400}
- component: {fileID: 33641203941365846}
- component: {fileID: 23960953856964188}
- component: {fileID: 111989919729618100}
- component: {fileID: 114187293852465328}
m_Layer: 0 m_Layer: 0
m_Name: RipplePlane m_Name: 128xplane
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!4 &4104538227611206 --- !u!4 &4403276698753482
Transform: Transform:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1802124651185064} m_GameObject: {fileID: 1085291655187690}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 4, y: 1, z: 4} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children: []
- {fileID: 4607767398666284} m_Father: {fileID: 4893222388098864}
- {fileID: 4580214526593280} m_RootOrder: 1
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4580214526593280 --- !u!4 &4893222388098864
Transform: Transform:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1526515523882130} m_GameObject: {fileID: 1074163696516364}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 4, y: 1, z: 4}
m_Children: [] m_Children:
m_Father: {fileID: 4104538227611206} - {fileID: 4929360730828400}
m_RootOrder: 1 - {fileID: 4403276698753482}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4607767398666284 --- !u!4 &4929360730828400
Transform: Transform:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1049480624652460} m_GameObject: {fileID: 1492582809623812}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 4104538227611206} m_Father: {fileID: 4893222388098864}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!23 &23388984037506834 --- !u!23 &23495640269871906
MeshRenderer: MeshRenderer:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1049480624652460} m_GameObject: {fileID: 1085291655187690}
m_Enabled: 1 m_Enabled: 0
m_CastShadows: 1 m_CastShadows: 1
m_ReceiveShadows: 1 m_ReceiveShadows: 1
m_MotionVectors: 1 m_MotionVectors: 1
m_LightProbeUsage: 1 m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 1
m_Materials: m_Materials:
- {fileID: 2100000, guid: 5f377ddd01309ad4cb352876ed0fc22b, type: 2} - {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo: m_StaticBatchInfo:
firstSubMesh: 0 firstSubMesh: 0
subMeshCount: 0 subMeshCount: 0
...@@ -135,20 +135,20 @@ MeshRenderer: ...@@ -135,20 +135,20 @@ MeshRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingOrder: 0 m_SortingOrder: 0
--- !u!23 &23917298595123638 --- !u!23 &23960953856964188
MeshRenderer: MeshRenderer:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1526515523882130} m_GameObject: {fileID: 1492582809623812}
m_Enabled: 0 m_Enabled: 1
m_CastShadows: 1 m_CastShadows: 1
m_ReceiveShadows: 1 m_ReceiveShadows: 1
m_MotionVectors: 1 m_MotionVectors: 1
m_LightProbeUsage: 1 m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1 m_ReflectionProbeUsage: 1
m_Materials: m_Materials:
- {fileID: 10302, guid: 0000000000000000f000000000000000, type: 0} - {fileID: 2100000, guid: 5f377ddd01309ad4cb352876ed0fc22b, type: 2}
m_StaticBatchInfo: m_StaticBatchInfo:
firstSubMesh: 0 firstSubMesh: 0
subMeshCount: 0 subMeshCount: 0
...@@ -166,26 +166,26 @@ MeshRenderer: ...@@ -166,26 +166,26 @@ MeshRenderer:
m_LightmapParameters: {fileID: 0} m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0 m_SortingLayerID: 0
m_SortingOrder: 0 m_SortingOrder: 0
--- !u!33 &33088446716562156 --- !u!33 &33437110337189046
MeshFilter: MeshFilter:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1049480624652460} m_GameObject: {fileID: 1085291655187690}
m_Mesh: {fileID: 0} m_Mesh: {fileID: 10209, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &33376699165076374 --- !u!33 &33641203941365846
MeshFilter: MeshFilter:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0} m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}