diff --git a/IronToad_UnityProject/Assets/Animations.meta b/IronToad_UnityProject/Assets/Animations.meta new file mode 100644 index 0000000..b2e446b --- /dev/null +++ b/IronToad_UnityProject/Assets/Animations.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 653e5549e4b277c4facae79f936bb3e6 +folderAsset: yes +timeCreated: 1484972317 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Models.meta b/IronToad_UnityProject/Assets/Models.meta new file mode 100644 index 0000000..cb85efc --- /dev/null +++ b/IronToad_UnityProject/Assets/Models.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 9439645a6c5c6dc4391460bf243d99a9 +folderAsset: yes +timeCreated: 1484972317 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Models/M_Boat.FBX b/IronToad_UnityProject/Assets/Models/M_Boat.FBX new file mode 100644 index 0000000..1a025d3 Binary files /dev/null and b/IronToad_UnityProject/Assets/Models/M_Boat.FBX differ diff --git a/IronToad_UnityProject/Assets/Models/M_Boat.FBX.meta b/IronToad_UnityProject/Assets/Models/M_Boat.FBX.meta new file mode 100644 index 0000000..4f11a1d --- /dev/null +++ b/IronToad_UnityProject/Assets/Models/M_Boat.FBX.meta @@ -0,0 +1,81 @@ +fileFormatVersion: 2 +guid: 6d2ec77f0914eaa43bb1284587d7d234 +timeCreated: 1484955399 +licenseType: Free +ModelImporter: + serializedVersion: 19 + fileIDToRecycleName: + 100000: //RootNode + 400000: //RootNode + 2300000: //RootNode + 3300000: //RootNode + 4300000: boat + 9500000: //RootNode + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 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.2 + 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: + serializedVersion: 2 + human: [] + skeleton: [] + armTwist: 0.5 + foreArmTwist: 0.5 + upperLegTwist: 0.5 + legTwist: 0.5 + armStretch: 0.05 + legStretch: 0.05 + feetSpacing: 0 + rootMotionBoneName: + rootMotionBoneRotation: {x: 0, y: 0, z: 0, w: 1} + hasTranslationDoF: 0 + hasExtraRoot: 0 + skeletonHasParents: 1 + lastHumanDescriptionAvatarSource: {instanceID: 0} + animationType: 2 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Models/Materials.meta b/IronToad_UnityProject/Assets/Models/Materials.meta new file mode 100644 index 0000000..a8df099 --- /dev/null +++ b/IronToad_UnityProject/Assets/Models/Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 09e8828582845e14eaff20477097a3a9 +folderAsset: yes +timeCreated: 1484955399 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Models/Materials/No Name.mat b/IronToad_UnityProject/Assets/Models/Materials/No Name.mat new file mode 100644 index 0000000..e15f536 Binary files /dev/null and b/IronToad_UnityProject/Assets/Models/Materials/No Name.mat differ diff --git a/IronToad_UnityProject/Assets/Models/Materials/No Name.mat.meta b/IronToad_UnityProject/Assets/Models/Materials/No Name.mat.meta new file mode 100644 index 0000000..169a507 --- /dev/null +++ b/IronToad_UnityProject/Assets/Models/Materials/No Name.mat.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 90392ab8faa788c4198badcacd62f103 +timeCreated: 1484955399 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Physics Materials.meta b/IronToad_UnityProject/Assets/Physics Materials.meta new file mode 100644 index 0000000..b621718 --- /dev/null +++ b/IronToad_UnityProject/Assets/Physics Materials.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5448b4db62ef7a84db1e026d5a0ab9f7 +folderAsset: yes +timeCreated: 1484954738 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Physics Materials/Water.physicMaterial b/IronToad_UnityProject/Assets/Physics Materials/Water.physicMaterial new file mode 100644 index 0000000..bd32d04 Binary files /dev/null and b/IronToad_UnityProject/Assets/Physics Materials/Water.physicMaterial differ diff --git a/IronToad_UnityProject/Assets/Physics Materials/Water.physicMaterial.meta b/IronToad_UnityProject/Assets/Physics Materials/Water.physicMaterial.meta new file mode 100644 index 0000000..e34a01d --- /dev/null +++ b/IronToad_UnityProject/Assets/Physics Materials/Water.physicMaterial.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7306b2bc1a4eb1848aaec35e00857c19 +timeCreated: 1484954750 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Prefabs.meta b/IronToad_UnityProject/Assets/Prefabs.meta new file mode 100644 index 0000000..a686fa1 --- /dev/null +++ b/IronToad_UnityProject/Assets/Prefabs.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 9b86a2ac850130a4aadb3c416f7faa43 +folderAsset: yes +timeCreated: 1484955477 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Prefabs/Boat.prefab b/IronToad_UnityProject/Assets/Prefabs/Boat.prefab new file mode 100644 index 0000000..05a9a21 Binary files /dev/null and b/IronToad_UnityProject/Assets/Prefabs/Boat.prefab differ diff --git a/IronToad_UnityProject/Assets/Prefabs/Boat.prefab.meta b/IronToad_UnityProject/Assets/Prefabs/Boat.prefab.meta new file mode 100644 index 0000000..96f29d0 --- /dev/null +++ b/IronToad_UnityProject/Assets/Prefabs/Boat.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c8aa714f1d5073f43b7d42f73289d5df +timeCreated: 1484957074 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Prefabs/Crate.prefab b/IronToad_UnityProject/Assets/Prefabs/Crate.prefab new file mode 100644 index 0000000..272032e Binary files /dev/null and b/IronToad_UnityProject/Assets/Prefabs/Crate.prefab differ diff --git a/IronToad_UnityProject/Assets/Prefabs/Crate.prefab.meta b/IronToad_UnityProject/Assets/Prefabs/Crate.prefab.meta new file mode 100644 index 0000000..f4676c2 --- /dev/null +++ b/IronToad_UnityProject/Assets/Prefabs/Crate.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b708e82a945ea904cb0b2ae0db8244fc +timeCreated: 1484957112 +licenseType: Free +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Scripts/BoatController.cs b/IronToad_UnityProject/Assets/Scripts/BoatController.cs index 4a0e386..593e77e 100644 --- a/IronToad_UnityProject/Assets/Scripts/BoatController.cs +++ b/IronToad_UnityProject/Assets/Scripts/BoatController.cs @@ -3,19 +3,9 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -public class BoatController : WaterObject { +public class BoatController : BuoyantObject { - public override void OnWaterEnter() { - throw new NotImplementedException(); - } - - public override void OnWaterStay() { - throw new NotImplementedException(); - } - - public override void OnWaterExit() { - throw new NotImplementedException(); - } + public float trunSpeed = 0.5f; // Use this for initialization @@ -23,8 +13,15 @@ public class BoatController : WaterObject { } - // Update is called once per frame - void Update () { - - } + void Update() { + lookAtDir(Vector3.ProjectOnPlane(rb.velocity, Vector3.up)); + } + + + // Update is called once per frame + void lookAtDir(Vector3 inputDir) { + Quaternion targetRotation = Quaternion.LookRotation(inputDir,Vector3.up); + float str = Mathf.Min(trunSpeed * Time.deltaTime, 1); + transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, str); + } } diff --git a/IronToad_UnityProject/Assets/Scripts/BuoyantObject.cs b/IronToad_UnityProject/Assets/Scripts/BuoyantObject.cs index e88b12e..1e9f72c 100644 --- a/IronToad_UnityProject/Assets/Scripts/BuoyantObject.cs +++ b/IronToad_UnityProject/Assets/Scripts/BuoyantObject.cs @@ -10,33 +10,49 @@ public class BuoyantObject : WaterObject { [Tooltip ("How fast object will raise into the ")] public float BouancyValue = 5; + [Tooltip ("Local point, at which the object floats within the water")] + public Vector3 BouancyPoint = Vector3.zero; + //rigidbody attached to GameObject - private Rigidbody rb; + protected Rigidbody rb; + private float airDrag; + #region Unity Functions void Awake() { + rb = GetComponent(); + airDrag = rb.drag; } + #endregion Unity Functions - #endregion Unity Functions + public override void OnWaterStay(GameObject water,float waveHeight) { + Vector3 waterEntryPoint = transform.position; + waterEntryPoint.y = water.transform.position.y + waveHeight; - public override void OnWaterStay() { - + float distance = Vector3.Distance(transform.position + (BouancyPoint * transform.lossyScale.magnitude) , waterEntryPoint); + Vector3 force = Vector3.up * BouancyValue * Mathf.Pow(distance,1.5f); + if (waterEntryPoint.y < gameObject.transform.position.y + (BouancyPoint.y * transform.lossyScale.y)) + force = Vector3.zero; + rb.AddForce(force); + Vector3 dragVel = rb.velocity; + dragVel.y *= 0.98f; + rb.velocity = dragVel; } - public override void OnWaterEnter() { - throw new NotImplementedException(); + public override void OnWaterEnter(GameObject water) { + //rb.drag = 1; } - public override void OnWaterExit() { - throw new NotImplementedException(); + public override void OnWaterExit(GameObject water) { + // rb.drag = airDrag; } /// diff --git a/IronToad_UnityProject/Assets/Scripts/PlayerController.cs b/IronToad_UnityProject/Assets/Scripts/PlayerController.cs index 90e2946..5efcfcb 100644 --- a/IronToad_UnityProject/Assets/Scripts/PlayerController.cs +++ b/IronToad_UnityProject/Assets/Scripts/PlayerController.cs @@ -4,13 +4,33 @@ using UnityEngine; public class PlayerController : MonoBehaviour { - // Use this for initialization - void Start () { - - } - // Update is called once per frame void Update () { - - } + + if (Input.GetButtonDown("Fire1")) { + Debug.Log("Click"); + RaycastHit hit; + Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); + + LayerMask rayMask = (1 << 4); + + Debug.DrawRay(ray.origin, ray.direction * 100, Color.green); + + if (Physics.Raycast(ray, out hit, Mathf.Infinity,rayMask)) { + WaterController waterScript = hit.collider.gameObject.GetComponent(); + Debug.DrawLine(Camera.main.transform.position, hit.point, Color.red,1); + + Debug.Log("I hit: " + hit.transform.name); + if (waterScript != null) + waterScript.CreateWave(hit.point, 10, 5); + + } + + + } + + + + + } } diff --git a/IronToad_UnityProject/Assets/Scripts/WaterController.cs b/IronToad_UnityProject/Assets/Scripts/WaterController.cs index 9f855ed..79b5105 100644 --- a/IronToad_UnityProject/Assets/Scripts/WaterController.cs +++ b/IronToad_UnityProject/Assets/Scripts/WaterController.cs @@ -4,6 +4,16 @@ using UnityEngine; public class WaterController : MonoBehaviour { + + public AnimationCurve RipplePower; + + private float waveOffset = 0; + public float waveScale = 1; + public float waterWidth = 1; + public float waveSpeed = 1; + public float maxWaveHeight = 2; + + #region Unity Functions // Use this for initialization void Start() { @@ -13,6 +23,8 @@ public class WaterController : MonoBehaviour { // Update is called once per frame void Update() { + waveOffset += 0.1f *waveSpeed * Time.deltaTime; + } #endregion Unity Fucntions @@ -28,25 +40,56 @@ public class WaterController : MonoBehaviour { public void CreateWave(Vector3 point, float radius, float power){ //find all colliders within the wave distance - Collider[] colliders = Physics.OverlapSphere(point, radius); - foreach (Collider hit in colliders) { - Rigidbody rb = hit.GetComponent(); + StartCoroutine(waveController(point, radius, power, 2)); - if (rb != null) - rb.AddExplosionForce(power, point, radius, 0.0f); - } + } + #endregion Interaction Functions + + #region Helper Functions + + public IEnumerator waveController (Vector3 point, float radius, float power, float rippleTime) { + + + float elapsedTime = 0.0f; + + while (elapsedTime < rippleTime) { + + float curRippleForce = RipplePower.Evaluate(elapsedTime / rippleTime); - #endregion Interaction Functions + Collider[] colliders = Physics.OverlapSphere(point, radius); + foreach (Collider hit in colliders) { + + + Rigidbody rb = hit.GetComponent(); + + Debug.DrawLine(point, hit.transform.position, Color.blue, 1); + + if (rb != null) { + Debug.DrawLine(point, hit.transform.position, Color.blue, 1); + Vector3 flatPoint = new Vector3(point.x, hit.transform.position.y, point.z); + rb.AddExplosionForce(power * curRippleForce, point, radius, 0.0f); + } + } + + yield return new WaitForEndOfFrame(); + elapsedTime += Time.deltaTime; + } } + + + + #endregion Helper Functions + + #region Collision Functions void OnTriggerEnter(Collider other) { //calls appropriate function if the object should interact with the water on enter WaterObject waterInteraction = other.gameObject.GetComponent(); if (waterInteraction != null) { - waterInteraction.OnWaterEnter(); + waterInteraction.OnWaterEnter(gameObject); } } @@ -56,7 +99,13 @@ public class WaterController : MonoBehaviour { //calls appropriate function if the object should interact with the water on stay WaterObject waterInteraction = other.gameObject.GetComponent(); if (waterInteraction != null) { - waterInteraction.OnWaterStay(); + + Vector2 waveCoords = new Vector2(other.transform.position.x, other.transform.position.z); + waveCoords = waveCoords / waterWidth * waveScale; + float waveHeight = Mathf.PerlinNoise(waveCoords.x, waveCoords.y + waveOffset); + + + waterInteraction.OnWaterStay(gameObject,waveHeight * maxWaveHeight); } } @@ -65,7 +114,7 @@ public class WaterController : MonoBehaviour { //calls appropriate function if the object should interact with the water on exit WaterObject waterInteraction = other.gameObject.GetComponent(); if (waterInteraction != null) { - waterInteraction.OnWaterExit(); + waterInteraction.OnWaterExit(gameObject); } } diff --git a/IronToad_UnityProject/Assets/Scripts/WaterObject.cs b/IronToad_UnityProject/Assets/Scripts/WaterObject.cs index 2ea5ecf..a15a621 100644 --- a/IronToad_UnityProject/Assets/Scripts/WaterObject.cs +++ b/IronToad_UnityProject/Assets/Scripts/WaterObject.cs @@ -7,17 +7,17 @@ public abstract class WaterObject : MonoBehaviour { /// /// Called when object intersects water plane /// - public abstract void OnWaterEnter(); + public abstract void OnWaterEnter(GameObject water); /// /// Called while objects stays in water /// - public abstract void OnWaterStay(); + public abstract void OnWaterStay(GameObject water,float waveHeight); /// /// Called when object leaves water /// - public abstract void OnWaterExit(); + public abstract void OnWaterExit(GameObject water); } diff --git a/IronToad_UnityProject/Assets/Shaders.meta b/IronToad_UnityProject/Assets/Shaders.meta new file mode 100644 index 0000000..5f06510 --- /dev/null +++ b/IronToad_UnityProject/Assets/Shaders.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: bfbf638121c6c304da5c93c85a196a42 +folderAsset: yes +timeCreated: 1484972473 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Shaders/TwoToneDiffuse.shader b/IronToad_UnityProject/Assets/Shaders/TwoToneDiffuse.shader new file mode 100644 index 0000000..63221f2 --- /dev/null +++ b/IronToad_UnityProject/Assets/Shaders/TwoToneDiffuse.shader @@ -0,0 +1,125 @@ +// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld' + +// Shader created with Shader Forge v1.30 +// Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/ +// Note: Manually altering this data may prevent you from opening it in Shader Forge +/*SF_DATA;ver:1.30;sub:START;pass:START;ps:flbk:,iptp:0,cusa:False,bamd:0,lico:0,lgpr:1,limd:0,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,hqlp:False,rprd:False,enco:False,rmgx:True,rpth:0,vtps:0,hqsc:True,nrmq:1,nrsp:0,vomd:0,spxs:False,tesm:0,olmd:1,culm:0,bsrc:0,bdst:1,dpts:2,wrdp:True,dith:0,rfrpo:True,rfrpn:Refraction,coma:15,ufog:True,aust:True,igpj:False,qofs:0,qpre:1,rntp:1,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.01,fgrn:0,fgrf:300,stcl:False,stva:128,stmr:255,stmw:255,stcp:6,stps:0,stfa:0,stfz:0,ofsf:0,ofsu:0,f2p0:False,fnsp:False,fnfb:False;n:type:ShaderForge.SFN_Final,id:9361,x:33209,y:32712,varname:node_9361,prsc:2|normal-7335-RGB,custl-4882-OUT,olcol-2127-OUT;n:type:ShaderForge.SFN_Dot,id:6424,x:31547,y:33253,varname:node_6424,prsc:2,dt:0|A-3093-OUT,B-321-OUT;n:type:ShaderForge.SFN_Slider,id:5658,x:30329,y:33392,ptovrint:False,ptlb:Shadows,ptin:_Shadows,varname:node_5658,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:-1,cur:0,max:1;n:type:ShaderForge.SFN_NormalVector,id:7295,x:30447,y:33021,prsc:2,pt:True;n:type:ShaderForge.SFN_LightVector,id:7110,x:30447,y:33197,varname:node_7110,prsc:2;n:type:ShaderForge.SFN_Code,id:3093,x:30813,y:33114,varname:node_3093,prsc:2,code:ZgBsAG8AYQB0ADMAIAByAGUAdABWAGEAbAAgAD0AIABOAG8AcgBtADsACgAKAGkAbgB0ACAAcABvAHMAIAA9ACAAcwBpAGcAbgAoAFMAbABpAGQAZQByACkAOwAKAAoAcgBlAHQAVgBhAGwAIAA9ACAAbABlAHIAcAAoAE4AbwByAG0ALAAoAHAAbwBzACAAKgAgAEwAaQBnAGgAdAApACwAIAAoAHAAbwBzACAAKgAgAFMAbABpAGQAZQByACkAIAAvACAAMgApADsACgAKAHIAZQB0AHUAcgBuACAAcgBlAHQAVgBhAGwAOwAKAA==,output:2,fname:LerpnegLerp,width:422,height:155,input:2,input:2,input:0,input_1_label:Norm,input_2_label:Light,input_3_label:Slider|A-7295-OUT,B-7110-OUT,C-5658-OUT;n:type:ShaderForge.SFN_Color,id:9263,x:31810,y:32895,ptovrint:False,ptlb:HighLight,ptin:_HighLight,varname:node_9263,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:1,c2:0.5,c3:0.5,c4:1;n:type:ShaderForge.SFN_Color,id:6362,x:31810,y:32402,ptovrint:False,ptlb:LowLight,ptin:_LowLight,varname:_HighLight_copy,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,c1:0,c2:0.5,c3:0.5,c4:1;n:type:ShaderForge.SFN_Lerp,id:4882,x:32569,y:32899,varname:node_4882,prsc:2|A-2411-OUT,B-982-OUT,T-4220-OUT;n:type:ShaderForge.SFN_Relay,id:2127,x:32559,y:32659,varname:node_2127,prsc:2|IN-2411-OUT;n:type:ShaderForge.SFN_Slider,id:260,x:31143,y:33716,ptovrint:False,ptlb:Gradiant,ptin:_Gradiant,varname:node_260,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:-1,cur:-1,max:1;n:type:ShaderForge.SFN_Code,id:9708,x:32006,y:33414,varname:node_9708,prsc:2,code:ZgBsAG8AYQB0ACAAcgBlAHQAVgBhAGwAOwAKAAoAZgBsAG8AYQB0ACAAdAAgAD0AIAAoACgASQBuAHAAdQB0ACAAKwAgAFMAbABpAGQAZQByACkALwAoADIAKgBTAGwAaQBkAGUAcgApACkAOwAKAHIAZQB0AFYAYQBsACAAPQAgAGwAZQByAHAAIAAoADAALAAxACwAdAApADsACgAKAHIAZQB0AHUAcgBuACAAYwBsAGEAbQBwACAAKAByAGUAdABWAGEAbAAsACAAMAAuADAALAAgADEALgAwACkAOwAKAA==,output:0,fname:CeilifGrad,width:339,height:149,input:0,input:0,input_1_label:Input,input_2_label:Slider|A-6424-OUT,B-257-OUT;n:type:ShaderForge.SFN_LightVector,id:321,x:31167,y:33337,varname:node_321,prsc:2;n:type:ShaderForge.SFN_Slider,id:3114,x:32033,y:33977,ptovrint:False,ptlb:Pen. Intensity,ptin:_PenIntensity,varname:node_3114,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,min:0,cur:0,max:1;n:type:ShaderForge.SFN_LightAttenuation,id:1671,x:32252,y:33718,varname:node_1671,prsc:2;n:type:ShaderForge.SFN_Lerp,id:3593,x:32469,y:33784,varname:node_3593,prsc:2|A-1597-OUT,B-1671-OUT,T-3114-OUT;n:type:ShaderForge.SFN_Vector1,id:1597,x:32206,y:33889,varname:node_1597,prsc:2,v1:1;n:type:ShaderForge.SFN_Multiply,id:4220,x:32678,y:33602,varname:node_4220,prsc:2|A-9708-OUT,B-3593-OUT;n:type:ShaderForge.SFN_TexCoord,id:9176,x:30931,y:33742,varname:node_9176,prsc:2,uv:0;n:type:ShaderForge.SFN_TexCoord,id:1762,x:31513,y:32152,varname:node_1762,prsc:2,uv:0;n:type:ShaderForge.SFN_Tex2d,id:7335,x:32519,y:32229,ptovrint:False,ptlb:Normal Map,ptin:_NormalMap,varname:node_7335,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,tex:bbab0a6f7bae9cf42bf057d8ee2755f6,ntxv:3,isnm:True|UVIN-1762-UVOUT;n:type:ShaderForge.SFN_Add,id:6459,x:31564,y:33798,varname:node_6459,prsc:2|A-260-OUT,B-8009-R;n:type:ShaderForge.SFN_Tex2d,id:8009,x:31272,y:33844,ptovrint:False,ptlb:Gradient Map,ptin:_GradientMap,varname:node_8009,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:2,isnm:False|UVIN-9176-UVOUT;n:type:ShaderForge.SFN_Clamp01,id:257,x:31736,y:33709,varname:node_257,prsc:2|IN-6459-OUT;n:type:ShaderForge.SFN_Lerp,id:2411,x:32036,y:32513,varname:node_2411,prsc:2|A-6362-RGB,B-3920-RGB,T-6894-OUT;n:type:ShaderForge.SFN_Tex2d,id:3920,x:31810,y:32572,ptovrint:False,ptlb:LowLight Texture,ptin:_LowLightTexture,varname:node_3920,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:2,isnm:False|UVIN-1762-UVOUT;n:type:ShaderForge.SFN_ToggleProperty,id:6894,x:31810,y:32784,ptovrint:False,ptlb:Use Textures,ptin:_UseTextures,varname:node_6894,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,on:False;n:type:ShaderForge.SFN_Lerp,id:982,x:32054,y:32919,varname:node_982,prsc:2|A-9263-RGB,B-3736-RGB,T-6894-OUT;n:type:ShaderForge.SFN_Tex2d,id:3736,x:31810,y:33067,ptovrint:False,ptlb:HighLight Texture_copy,ptin:_HighLightTexture_copy,varname:_LowLightTexture_copy,prsc:2,glob:False,taghide:False,taghdr:False,tagprd:False,tagnsco:False,tagnrm:False,ntxv:0,isnm:False|UVIN-1762-UVOUT;proporder:5658-260-9263-6362-6894-3736-3920-7335-8009-3114;pass:END;sub:END;*/ + +Shader "Geomantle/TwoToneDiffuse" { + Properties { + _Shadows ("Shadows", Range(-1, 1)) = 0 + _Gradiant ("Gradiant", Range(-1, 1)) = -1 + _HighLight ("HighLight", Color) = (1,0.5,0.5,1) + _LowLight ("LowLight", Color) = (0,0.5,0.5,1) + [MaterialToggle] _UseTextures ("Use Textures", Float ) = 0 + _HighLightTexture_copy ("HighLight Texture_copy", 2D) = "white" {} + _LowLightTexture ("LowLight Texture", 2D) = "black" {} + _NormalMap ("Normal Map", 2D) = "bump" {} + _GradientMap ("Gradient Map", 2D) = "black" {} + _PenIntensity ("Pen. Intensity", Range(0, 1)) = 0 + } + SubShader { + Tags { + "RenderType"="Opaque" + } + Pass { + Name "FORWARD" + Tags { + "LightMode"="ForwardBase" + } + + + CGPROGRAM + #pragma vertex vert + #pragma fragment frag + #define UNITY_PASS_FORWARDBASE + #include "UnityCG.cginc" + #include "AutoLight.cginc" + #include "Lighting.cginc" + #pragma multi_compile_fwdbase_fullshadows + #pragma multi_compile_fog + #pragma exclude_renderers gles3 metal d3d11_9x xbox360 xboxone ps3 ps4 psp2 + #pragma target 3.0 + uniform float _Shadows; + float3 LerpnegLerp( float3 Norm , float3 Light , float Slider ){ + float3 retVal = Norm; + + int pos = sign(Slider); + + retVal = lerp(Norm,(pos * Light), (pos * Slider) / 2); + + return retVal; + + } + + uniform float4 _HighLight; + uniform float4 _LowLight; + uniform float _Gradiant; + float CeilifGrad( float Input , float Slider ){ + float retVal; + + float t = ((Input + Slider)/(2*Slider)); + retVal = lerp (0,1,t); + + return clamp (retVal, 0.0, 1.0); + + } + + uniform float _PenIntensity; + uniform sampler2D _NormalMap; uniform float4 _NormalMap_ST; + uniform sampler2D _GradientMap; uniform float4 _GradientMap_ST; + uniform sampler2D _LowLightTexture; uniform float4 _LowLightTexture_ST; + uniform fixed _UseTextures; + uniform sampler2D _HighLightTexture_copy; uniform float4 _HighLightTexture_copy_ST; + struct VertexInput { + float4 vertex : POSITION; + float3 normal : NORMAL; + float4 tangent : TANGENT; + float2 texcoord0 : TEXCOORD0; + }; + struct VertexOutput { + float4 pos : SV_POSITION; + float2 uv0 : TEXCOORD0; + float4 posWorld : TEXCOORD1; + float3 normalDir : TEXCOORD2; + float3 tangentDir : TEXCOORD3; + float3 bitangentDir : TEXCOORD4; + LIGHTING_COORDS(5,6) + UNITY_FOG_COORDS(7) + }; + VertexOutput vert (VertexInput v) { + VertexOutput o = (VertexOutput)0; + o.uv0 = v.texcoord0; + o.normalDir = UnityObjectToWorldNormal(v.normal); + o.tangentDir = normalize( mul( unity_ObjectToWorld, float4( v.tangent.xyz, 0.0 ) ).xyz ); + o.bitangentDir = normalize(cross(o.normalDir, o.tangentDir) * v.tangent.w); + o.posWorld = mul(unity_ObjectToWorld, v.vertex); + o.pos = mul(UNITY_MATRIX_MVP, v.vertex ); + UNITY_TRANSFER_FOG(o,o.pos); + TRANSFER_VERTEX_TO_FRAGMENT(o) + return o; + } + float4 frag(VertexOutput i) : COLOR { + i.normalDir = normalize(i.normalDir); + float3x3 tangentTransform = float3x3( i.tangentDir, i.bitangentDir, i.normalDir); + float3 _NormalMap_var = UnpackNormal(tex2D(_NormalMap,TRANSFORM_TEX(i.uv0, _NormalMap))); + float3 normalLocal = _NormalMap_var.rgb; + float3 normalDirection = normalize(mul( normalLocal, tangentTransform )); // Perturbed normals + float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz); +////// Lighting: + float attenuation = LIGHT_ATTENUATION(i); + float4 _LowLightTexture_var = tex2D(_LowLightTexture,TRANSFORM_TEX(i.uv0, _LowLightTexture)); + float3 node_2411 = lerp(_LowLight.rgb,_LowLightTexture_var.rgb,_UseTextures); + float4 _HighLightTexture_copy_var = tex2D(_HighLightTexture_copy,TRANSFORM_TEX(i.uv0, _HighLightTexture_copy)); + float4 _GradientMap_var = tex2D(_GradientMap,TRANSFORM_TEX(i.uv0, _GradientMap)); + float3 finalColor = lerp(node_2411,lerp(_HighLight.rgb,_HighLightTexture_copy_var.rgb,_UseTextures),(CeilifGrad( dot(LerpnegLerp( normalDirection , lightDirection , _Shadows ),lightDirection) , saturate((_Gradiant+_GradientMap_var.r)) )*lerp(1.0,attenuation,_PenIntensity))); + fixed4 finalRGBA = fixed4(finalColor,1); + UNITY_APPLY_FOG(i.fogCoord, finalRGBA); + return finalRGBA; + } + ENDCG + } + } + FallBack "Diffuse" + CustomEditor "ShaderForgeMaterialInspector" +} diff --git a/IronToad_UnityProject/Assets/Shaders/TwoToneDiffuse.shader.meta b/IronToad_UnityProject/Assets/Shaders/TwoToneDiffuse.shader.meta new file mode 100644 index 0000000..d751aa7 --- /dev/null +++ b/IronToad_UnityProject/Assets/Shaders/TwoToneDiffuse.shader.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 5a54ffaff2b76814ca8e6209d7912ba2 +timeCreated: 1484972480 +licenseType: Free +ShaderImporter: + defaultTextures: [] + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Sound.meta b/IronToad_UnityProject/Assets/Sound.meta new file mode 100644 index 0000000..982e641 --- /dev/null +++ b/IronToad_UnityProject/Assets/Sound.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 091049497d8a5784f93123e69e2329d6 +folderAsset: yes +timeCreated: 1484972317 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Sound/Music.meta b/IronToad_UnityProject/Assets/Sound/Music.meta new file mode 100644 index 0000000..f5cf392 --- /dev/null +++ b/IronToad_UnityProject/Assets/Sound/Music.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1715d56e0d2b68246a82993db31014ab +folderAsset: yes +timeCreated: 1484972317 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Sound/SFX.meta b/IronToad_UnityProject/Assets/Sound/SFX.meta new file mode 100644 index 0000000..e235828 --- /dev/null +++ b/IronToad_UnityProject/Assets/Sound/SFX.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: de5a3adcedb96f64183518ac89622ade +folderAsset: yes +timeCreated: 1484972317 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Textures.meta b/IronToad_UnityProject/Assets/Textures.meta new file mode 100644 index 0000000..ffdd440 --- /dev/null +++ b/IronToad_UnityProject/Assets/Textures.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 2a6e699820a38a544acfc0015eb679a2 +folderAsset: yes +timeCreated: 1484972317 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/_Scenes/PhysicsTestScene.unity b/IronToad_UnityProject/Assets/_Scenes/PhysicsTestScene.unity index ec4f2e3..cd2e86d 100644 Binary files a/IronToad_UnityProject/Assets/_Scenes/PhysicsTestScene.unity and b/IronToad_UnityProject/Assets/_Scenes/PhysicsTestScene.unity differ