Browse Source

no message

master
ATC522-011\IGDA 8 years ago
parent
commit
1b75b59ccd
7 changed files with 110 additions and 112 deletions
  1. +19
    -0
      IronToad_UnityProject/Assets/Scripts/BuoyantObject.cs
  2. +13
    -2
      IronToad_UnityProject/Assets/Scripts/WaterController.cs
  3. +9
    -0
      IronToad_UnityProject/Assets/Sound.meta~33da7c3282ca6f5c80ab157e88e7a3f2b299d2eb
  4. BIN
      IronToad_UnityProject/Assets/_Scenes/PhysicsTestScene.unity
  5. +69
    -29
      IronToad_UnityProject/Assets/water/WaterShader.shader
  6. BIN
      IronToad_UnityProject/Assets/water/planeWater.FBX
  7. +0
    -81
      IronToad_UnityProject/Assets/water/planeWater.FBX.meta

+ 19
- 0
IronToad_UnityProject/Assets/Scripts/BuoyantObject.cs View File

@ -55,6 +55,25 @@ public class BuoyantObject : WaterObject {
// rb.drag = airDrag;
}
public virtual IEnumerator pushObject(Vector3 point,float power, float totalTime) {
Vector3 dir = transform.position - point;
dir = Vector3.ProjectOnPlane(dir, Vector3.up);
dir.Normalize();
float elapsedTime = 0;
while (elapsedTime < totalTime) {
Vector3 force = dir * power * Time.deltaTime;
rb.AddForce(force);
yield return new WaitForEndOfFrame();
elapsedTime += Time.deltaTime;
}
}
/// <summary>
///
/// </summary>

+ 13
- 2
IronToad_UnityProject/Assets/Scripts/WaterController.cs View File

@ -37,14 +37,25 @@ public class WaterController : MonoBehaviour {
/// <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){
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));
Collider[] colliders = Physics.OverlapSphere(point, radius);
foreach (Collider hit in colliders) {
Debug.Log(hit.name);
BuoyantObject hitScript = hit.gameObject.GetComponent<BuoyantObject>();
if (hitScript != null) {
Debug.DrawLine(point, hit.transform.position, Color.blue, 1);
StartCoroutine(hitScript.pushObject(point, power, 2));
}
//StartCoroutine(waveController(point, radius, power, 2));
}
}
#endregion Interaction Functions

+ 9
- 0
IronToad_UnityProject/Assets/Sound.meta~33da7c3282ca6f5c80ab157e88e7a3f2b299d2eb View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 0fbabcae9313543ffbf1429aeac3664d
folderAsset: yes
timeCreated: 1484963877
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

BIN
IronToad_UnityProject/Assets/_Scenes/PhysicsTestScene.unity View File


+ 69
- 29
IronToad_UnityProject/Assets/water/WaterShader.shader
File diff suppressed because it is too large
View File


BIN
IronToad_UnityProject/Assets/water/planeWater.FBX View File


+ 0
- 81
IronToad_UnityProject/Assets/water/planeWater.FBX.meta View File

@ -1,81 +0,0 @@
fileFormatVersion: 2
guid: bd1854f4908ffa544b88d16ba58fcbc6
timeCreated: 1484985428
licenseType: Pro
ModelImporter:
serializedVersion: 19
fileIDToRecycleName:
100000: //RootNode
400000: //RootNode
2300000: //RootNode
3300000: //RootNode
4300000: Plane001
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: 1
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:

Loading…
Cancel
Save