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/Scripts/BuoyantObject.cs b/IronToad_UnityProject/Assets/Scripts/BuoyantObject.cs index 1e9f72c..2b2d04d 100644 --- a/IronToad_UnityProject/Assets/Scripts/BuoyantObject.cs +++ b/IronToad_UnityProject/Assets/Scripts/BuoyantObject.cs @@ -28,7 +28,7 @@ public class BuoyantObject : WaterObject { #endregion Unity Functions - public override void OnWaterStay(GameObject water,float waveHeight) { + public override void OnWaterStay(WaterController water,float waveHeight) { Vector3 waterEntryPoint = transform.position; waterEntryPoint.y = water.transform.position.y + waveHeight; @@ -42,16 +42,16 @@ public class BuoyantObject : WaterObject { rb.AddForce(force); Vector3 dragVel = rb.velocity; - dragVel.y *= 0.98f; + dragVel.y *= 0.9f; rb.velocity = dragVel; } - public override void OnWaterEnter(GameObject water) { + public override void OnWaterEnter(WaterController water) { //rb.drag = 1; } - public override void OnWaterExit(GameObject water) { + public override void OnWaterExit(WaterController water) { // rb.drag = airDrag; } diff --git a/IronToad_UnityProject/Assets/Scripts/HeavyObject.cs b/IronToad_UnityProject/Assets/Scripts/HeavyObject.cs new file mode 100644 index 0000000..486e53d --- /dev/null +++ b/IronToad_UnityProject/Assets/Scripts/HeavyObject.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public abstract class HeavyObject : WaterObject { + + public float splashRadius; + public float splashPower; + + public override void OnWaterEnter(WaterController water) { + water.CreateWave(transform.position,splashRadius,splashPower) + } + +} diff --git a/IronToad_UnityProject/Assets/Scripts/HeavyObject.cs.meta b/IronToad_UnityProject/Assets/Scripts/HeavyObject.cs.meta new file mode 100644 index 0000000..3db3c19 --- /dev/null +++ b/IronToad_UnityProject/Assets/Scripts/HeavyObject.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 9fd6f6961a3776a4182416c3c917f017 +timeCreated: 1484987123 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Scripts/PlayerController.cs b/IronToad_UnityProject/Assets/Scripts/PlayerController.cs index 5efcfcb..47ba936 100644 --- a/IronToad_UnityProject/Assets/Scripts/PlayerController.cs +++ b/IronToad_UnityProject/Assets/Scripts/PlayerController.cs @@ -4,6 +4,10 @@ using UnityEngine; public class PlayerController : MonoBehaviour { + public float power; + public float radius; + public float time; + // Update is called once per frame void Update () { @@ -22,7 +26,7 @@ public class PlayerController : MonoBehaviour { Debug.Log("I hit: " + hit.transform.name); if (waterScript != null) - waterScript.CreateWave(hit.point, 10, 5); + waterScript.CreateWave(hit.point, radius, power); } diff --git a/IronToad_UnityProject/Assets/Scripts/WaterController.cs b/IronToad_UnityProject/Assets/Scripts/WaterController.cs index 79b5105..d967128 100644 --- a/IronToad_UnityProject/Assets/Scripts/WaterController.cs +++ b/IronToad_UnityProject/Assets/Scripts/WaterController.cs @@ -40,6 +40,8 @@ public class WaterController : MonoBehaviour { public void CreateWave(Vector3 point, float radius, float power){ //find all colliders within the wave distance + + point.y = transform.position.y; StartCoroutine(waveController(point, radius, power, 2)); @@ -48,7 +50,7 @@ public class WaterController : MonoBehaviour { #region Helper Functions - public IEnumerator waveController (Vector3 point, float radius, float power, float rippleTime) { + private IEnumerator waveController (Vector3 point, float radius, float power, float rippleTime) { float elapsedTime = 0.0f; @@ -89,7 +91,7 @@ public class WaterController : MonoBehaviour { //calls appropriate function if the object should interact with the water on enter WaterObject waterInteraction = other.gameObject.GetComponent(); if (waterInteraction != null) { - waterInteraction.OnWaterEnter(gameObject); + waterInteraction.OnWaterEnter(this); } } @@ -105,7 +107,7 @@ public class WaterController : MonoBehaviour { float waveHeight = Mathf.PerlinNoise(waveCoords.x, waveCoords.y + waveOffset); - waterInteraction.OnWaterStay(gameObject,waveHeight * maxWaveHeight); + waterInteraction.OnWaterStay(this,waveHeight * maxWaveHeight); } } @@ -114,7 +116,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(gameObject); + waterInteraction.OnWaterExit(this); } } diff --git a/IronToad_UnityProject/Assets/Scripts/WaterObject.cs b/IronToad_UnityProject/Assets/Scripts/WaterObject.cs index a15a621..85720ad 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(GameObject water); + public abstract void OnWaterEnter(WaterController water); /// /// Called while objects stays in water /// - public abstract void OnWaterStay(GameObject water,float waveHeight); + public abstract void OnWaterStay(WaterController water,float waveHeight); /// /// Called when object leaves water /// - public abstract void OnWaterExit(GameObject water); + public abstract void OnWaterExit(WaterController water); } diff --git a/IronToad_UnityProject/Assets/Scripts/WaterSetUp.cs b/IronToad_UnityProject/Assets/Scripts/WaterSetUp.cs new file mode 100644 index 0000000..6ff9da1 --- /dev/null +++ b/IronToad_UnityProject/Assets/Scripts/WaterSetUp.cs @@ -0,0 +1,37 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class WaterSetUp : MonoBehaviour { + + // Use this for initialization + void Start () { + Vector3 originalScale = transform.localScale; + + Vector2 texScale = Vector3.one;// GetComponent().material.GetTextureScale("_Perlin"); + + + + transform.localScale = Vector3.one; + + for (float x = -originalScale.x/2; x < originalScale.x / 2; x++) { + for (float z = -originalScale.z / 2; z < originalScale.z/2; z++) { + //Debug.Log("blah"); + + Vector3 pos = transform.position; + pos.x += transform.lossyScale.x * x; + pos.z += transform.lossyScale.z * z; + + Vector2 texOffset = new Vector2(texScale.x * x, texScale.y * z); + + GameObject waterClone = Instantiate(gameObject, pos, transform.rotation, transform); + // waterClone.GetComponent().material.SetTextureOffset("_Diffuse", texOffset); + // waterClone.GetComponent().material.SetTextureOffset("_Normals", texOffset); + // waterClone.GetComponent().material.SetTextureOffset("_Perlin", texOffset); + // waterClone.GetComponent().material.SetTextureOffset("_Perlin_copy", texOffset); + } + } + Debug.Log("blah"); + } + +} diff --git a/IronToad_UnityProject/Assets/Scripts/WaterSetUp.cs.meta b/IronToad_UnityProject/Assets/Scripts/WaterSetUp.cs.meta new file mode 100644 index 0000000..3f71e55 --- /dev/null +++ b/IronToad_UnityProject/Assets/Scripts/WaterSetUp.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 2c43fce4399eca2488874b64aef6786c +timeCreated: 1484981374 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + 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..a4f829c --- /dev/null +++ b/IronToad_UnityProject/Assets/Sound/Music.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1715d56e0d2b68246a82993db31014ab +folderAsset: yes +timeCreated: 1484979777 +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..0c3fd08 --- /dev/null +++ b/IronToad_UnityProject/Assets/Sound/SFX.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: de5a3adcedb96f64183518ac89622ade +folderAsset: yes +timeCreated: 1484979777 +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: