@ -0,0 +1,8 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 0dc735b44f9a698438f584c02c7555c6 | |||||
timeCreated: 1484910089 | |||||
licenseType: Free | |||||
NativeFormatImporter: | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,30 @@ | |||||
using System; | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using UnityEngine; | |||||
public class BoatController : WaterObject { | |||||
public override void OnWaterEnter() { | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void OnWaterStay() { | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void OnWaterExit() { | |||||
throw new NotImplementedException(); | |||||
} | |||||
// Use this for initialization | |||||
void Start () { | |||||
} | |||||
// Update is called once per frame | |||||
void Update () { | |||||
} | |||||
} |
@ -0,0 +1,12 @@ | |||||
fileFormatVersion: 2 | |||||
guid: f3cdb8edf7874ca4b9c189bec10bf8f7 | |||||
timeCreated: 1484910428 | |||||
licenseType: Free | |||||
MonoImporter: | |||||
serializedVersion: 2 | |||||
defaultReferences: [] | |||||
executionOrder: 0 | |||||
icon: {instanceID: 0} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,56 @@ | |||||
using System; | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using UnityEngine; | |||||
[RequireComponent (typeof(Rigidbody))] | |||||
public class BuoyantObject : WaterObject { | |||||
[Tooltip ("How fast object will raise into the ")] | |||||
public float BouancyValue = 5; | |||||
//rigidbody attached to GameObject | |||||
private Rigidbody rb; | |||||
#region Unity Functions | |||||
void Awake() { | |||||
rb = GetComponent<Rigidbody>(); | |||||
} | |||||
#endregion Unity Functions | |||||
public override void OnWaterStay() { | |||||
} | |||||
public override void OnWaterEnter() { | |||||
throw new NotImplementedException(); | |||||
} | |||||
public override void OnWaterExit() { | |||||
throw new NotImplementedException(); | |||||
} | |||||
/// <summary> | |||||
/// | |||||
/// </summary> | |||||
public void BuoyancyCalc() { | |||||
} | |||||
} |
@ -0,0 +1,12 @@ | |||||
fileFormatVersion: 2 | |||||
guid: bf1065d694a5ecb4d911457e68bf2c0a | |||||
timeCreated: 1484911019 | |||||
licenseType: Free | |||||
MonoImporter: | |||||
serializedVersion: 2 | |||||
defaultReferences: [] | |||||
executionOrder: 0 | |||||
icon: {instanceID: 0} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,16 @@ | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using UnityEngine; | |||||
public class PlayerController : MonoBehaviour { | |||||
// Use this for initialization | |||||
void Start () { | |||||
} | |||||
// Update is called once per frame | |||||
void Update () { | |||||
} | |||||
} |
@ -0,0 +1,12 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 8a828132c9a87134089c2a7e23e0c299 | |||||
timeCreated: 1484911651 | |||||
licenseType: Free | |||||
MonoImporter: | |||||
serializedVersion: 2 | |||||
defaultReferences: [] | |||||
executionOrder: 0 | |||||
icon: {instanceID: 0} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,75 @@ | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using UnityEngine; | |||||
public class WaterController : MonoBehaviour { | |||||
#region Unity Functions | |||||
// Use this for initialization | |||||
void Start() { | |||||
} | |||||
// Update is called once per frame | |||||
void Update() { | |||||
} | |||||
#endregion Unity Fucntions | |||||
#region Interaction Functions | |||||
/// <summary> | |||||
/// Pushes any objects in water away from this point | |||||
/// </summary> | |||||
/// <param name="point"> point where water is createds</param> | |||||
/// <param name="radius"> radius of effected object</param> | |||||
/// <param name="power"> power with chich the objects are pushed</param> | |||||
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<Rigidbody>(); | |||||
if (rb != null) | |||||
rb.AddExplosionForce(power, point, radius, 0.0f); | |||||
} | |||||
#endregion Interaction 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<WaterObject>(); | |||||
if (waterInteraction != null) { | |||||
waterInteraction.OnWaterEnter(); | |||||
} | |||||
} | |||||
void OnTriggerStay(Collider other) { | |||||
//calls appropriate function if the object should interact with the water on stay | |||||
WaterObject waterInteraction = other.gameObject.GetComponent<WaterObject>(); | |||||
if (waterInteraction != null) { | |||||
waterInteraction.OnWaterStay(); | |||||
} | |||||
} | |||||
void OnTriggerExit(Collider other) { | |||||
//calls appropriate function if the object should interact with the water on exit | |||||
WaterObject waterInteraction = other.gameObject.GetComponent<WaterObject>(); | |||||
if (waterInteraction != null) { | |||||
waterInteraction.OnWaterExit(); | |||||
} | |||||
} | |||||
#endregion Collision Functions | |||||
} |
@ -0,0 +1,12 @@ | |||||
fileFormatVersion: 2 | |||||
guid: d88731800dd7c774dbc4075ca3b78a2b | |||||
timeCreated: 1484911290 | |||||
licenseType: Free | |||||
MonoImporter: | |||||
serializedVersion: 2 | |||||
defaultReferences: [] | |||||
executionOrder: 0 | |||||
icon: {instanceID: 0} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,23 @@ | |||||
using System.Collections; | |||||
using System.Collections.Generic; | |||||
using UnityEngine; | |||||
public abstract class WaterObject : MonoBehaviour { | |||||
/// <summary> | |||||
/// Called when object intersects water plane | |||||
/// </summary> | |||||
public abstract void OnWaterEnter(); | |||||
/// <summary> | |||||
/// Called while objects stays in water | |||||
/// </summary> | |||||
public abstract void OnWaterStay(); | |||||
/// <summary> | |||||
/// Called when object leaves water | |||||
/// </summary> | |||||
public abstract void OnWaterExit(); | |||||
} |
@ -0,0 +1,12 @@ | |||||
fileFormatVersion: 2 | |||||
guid: b04e4b09361f56941bbf228e6175152d | |||||
timeCreated: 1484910555 | |||||
licenseType: Free | |||||
MonoImporter: | |||||
serializedVersion: 2 | |||||
defaultReferences: [] | |||||
executionOrder: 0 | |||||
icon: {instanceID: 0} | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |
@ -0,0 +1,8 @@ | |||||
fileFormatVersion: 2 | |||||
guid: 2d7edb9bb9e70704db16665451d9f60e | |||||
timeCreated: 1484909912 | |||||
licenseType: Free | |||||
DefaultImporter: | |||||
userData: | |||||
assetBundleName: | |||||
assetBundleVariant: |