Browse Source

fixed boulder, SFX and reset scene

master
Sagittaeri 8 years ago
parent
commit
6b52b19269
18 changed files with 356 additions and 179 deletions
  1. +275
    -0
      IronToad_UnityProject/Assets/Art/Models/catapult_rock.OBJ
  2. +1
    -1
      IronToad_UnityProject/Assets/Art/Models/catapult_rock.OBJ.meta
  3. +0
    -82
      IronToad_UnityProject/Assets/Art/Models/lightHouse_LOW.obj.meta
  4. +0
    -82
      IronToad_UnityProject/Assets/Art/Models/pier.obj.meta
  5. BIN
      IronToad_UnityProject/Assets/Prefabs/catapultExplosion.prefab
  6. +10
    -0
      IronToad_UnityProject/Assets/Scripts/AlertController.cs
  7. +6
    -1
      IronToad_UnityProject/Assets/Scripts/AudioController.cs
  8. +4
    -1
      IronToad_UnityProject/Assets/Scripts/BoatController.cs
  9. +23
    -2
      IronToad_UnityProject/Assets/Scripts/Boulder.cs
  10. +13
    -1
      IronToad_UnityProject/Assets/Scripts/Catapult.cs
  11. +1
    -1
      IronToad_UnityProject/Assets/Scripts/HeavyObject.cs
  12. +2
    -2
      IronToad_UnityProject/Assets/Scripts/HidingSpot.cs
  13. +15
    -0
      IronToad_UnityProject/Assets/Scripts/Lighthouse.cs
  14. +5
    -4
      IronToad_UnityProject/Assets/Scripts/PlayerController.cs
  15. +1
    -2
      IronToad_UnityProject/Assets/Scripts/WaterController.cs
  16. +0
    -0
      IronToad_UnityProject/Assets/Shaders/TwoToneDiffuse.shader
  17. +0
    -0
      IronToad_UnityProject/Assets/Shaders/TwoToneDiffuse.shader.meta
  18. BIN
      IronToad_UnityProject/Assets/_Scenes/GreyBox_Prototype.unity

+ 275
- 0
IronToad_UnityProject/Assets/Art/Models/catapult_rock.OBJ View File

@ -0,0 +1,275 @@
# Wavefront Obj file
#
# verts: 46 uv-s: 79
mtllib low_rock.mtl
g Group48238
v -4.776813 10.980130 4.445988
v -2.244370 7.937094 5.869603
v 10.267232 9.167744 -5.010049
v -5.851051 10.287252 -5.756045
v 10.863520 2.327922 -4.286652
v 9.299958 8.505049 0.029811
v -7.281589 0.605299 -5.336817
v 4.065229 0.797379 3.070290
v -1.132540 1.013275 -7.123520
v -1.482180 0.430190 0.107312
v -10.801358 4.118680 -3.343990
v 7.387365 -1.174274 -3.183793
v -10.283543 1.903879 4.895473
v 5.153004 9.586656 -6.453586
v -0.089858 4.033408 8.170572
v -2.147457 6.438172 -6.189501
v 2.013127 10.215971 0.780983
v -10.268378 2.614002 2.032427
v -11.269932 8.580400 4.701735
v 8.585827 6.358153 6.764898
v -9.152101 7.373600 2.128722
v 9.567997 -0.206866 3.629837
v -5.757145 6.207551 -3.976367
v 2.342942 10.661632 4.435289
v 7.824727 5.736160 -6.122197
v -8.825826 9.205590 6.306860
v 2.157970 -0.481906 -6.053940
v 7.314702 10.152739 6.088633
v -9.784004 0.213184 -4.039094
v -1.650344 10.616589 0.059266
v 1.005551 0.995913 8.679687
v -8.913321 10.319478 0.741202
v 7.243292 0.216305 -6.655372
v -5.663384 0.064892 -1.061861
v 10.648342 1.097433 6.098054
v -10.398486 10.324741 4.812073
v -5.807967 3.635802 -4.698321
v 10.183737 5.493643 -2.569688
v -8.536263 0.859680 6.293212
v -5.641757 9.426117 1.572213
v 7.745552 10.560678 -1.981335
v -8.547244 7.213405 -1.118869
v -8.492620 0.318807 3.085274
v 9.598336 11.003506 3.546372
v 3.362010 1.747406 -7.530261
v -6.183584 0.341781 6.265565
# 46 positions
vt 0.237996 0.400286
vt 0.382977 0.291918
vt 0.210032 0.300281
vt 0.160773 0.709959
vt 0.005000 0.872679
vt 0.021684 0.609487
vt 0.372929 0.672060
vt 0.530343 0.641721
vt 0.758974 0.694714
vt 0.776158 0.796600
vt 0.793143 0.728122
vt 0.618502 0.694365
vt 0.678303 0.097061
vt 0.766885 0.005000
vt 0.503693 0.021757
vt 0.608073 0.475704
vt 0.838707 0.478132
vt 0.789376 0.603956
vt 0.453107 0.769651
vt 0.540983 0.711283
vt 0.525133 0.831825
vt 0.178034 0.797581
vt 0.160068 0.971865
vt 0.111966 0.934687
vt 0.801100 0.236570
vt 0.885285 0.152538
vt 0.765854 0.164088
vt 0.633455 0.732756
vt 0.662319 0.794297
vt 0.139164 0.167600
vt 0.288747 0.088142
vt 0.316763 0.917929
vt 0.458907 0.684683
vt 0.125781 0.035986
vt 0.315125 0.005000
vt 0.062079 0.468999
vt 0.581874 0.548354
vt 0.764639 0.102577
vt 0.666151 0.871971
vt 0.591861 0.827483
vt 0.592631 0.982882
vt 0.371780 0.091588
vt 0.357395 0.213217
vt 0.379855 0.472445
vt 0.436126 0.460058
vt 0.439791 0.113852
vt 0.381372 0.031776
vt 0.062740 0.412728
vt 0.005000 0.240780
vt 0.546529 0.209254
vt 0.265693 0.635181
vt 0.265437 0.805469
vt 0.177083 0.536245
vt 0.833580 0.941817
vt 0.831054 0.771418
vt 0.740170 0.925191
vt 0.196959 0.614493
vt 0.347959 0.976963
vt 0.584890 0.915933
vt 0.831371 0.078519
vt 0.304981 0.924382
vt 0.813593 0.715062
vt 0.575327 0.262574
vt 0.453698 0.245874
vt 0.310201 0.538338
vt 0.274449 0.500723
vt 0.654029 0.226812
vt 0.860952 0.245949
vt 0.138806 0.467955
vt 0.309204 0.498842
vt 0.340243 0.438990
vt 0.591735 0.730117
vt 0.367110 0.195369
vt 0.066747 0.010147
vt 0.377390 0.728585
vt 0.338064 0.497420
vt 0.039526 0.995000
vt 0.095510 0.510790
vt 0.244176 0.979001
# 79 texture coordinates
vn -0.051692 0.988828 0.139809
vn -0.062520 0.160372 0.985075
vn 0.778033 0.445426 -0.443012
vn -0.302708 0.749467 -0.588784
vn 0.907418 -0.288284 -0.305753
vn 0.846244 0.527889 -0.072139
vn -0.190974 -0.732241 -0.653722
vn -0.097698 -0.986952 0.127988
vn -0.157613 -0.814492 -0.558356
vn -0.045343 -0.997405 0.055915
vn -0.817294 0.334573 -0.469140
vn 0.106997 -0.993853 0.028428
vn -0.935898 -0.150545 0.318481
vn 0.049716 0.794902 -0.604698
vn -0.156681 0.306714 0.938817
vn -0.132934 -0.007705 -0.991095
vn 0.088483 0.996070 -0.003934
vn -0.983588 -0.150529 0.099481
vn -0.993479 -0.053129 0.100877
vn 0.226290 0.232110 0.946001
vn -0.935324 0.241325 -0.258709
vn 0.660223 -0.743641 0.105373
vn -0.512756 -0.116537 -0.850588
vn 0.037554 0.985901 -0.163063
vn 0.296753 0.093791 -0.950337
vn -0.268041 0.187733 0.944939
vn -0.152552 -0.952463 -0.263709
vn 0.051866 0.502351 0.863107
vn -0.743220 -0.657845 -0.121916
vn 0.010285 0.999287 -0.036331
vn 0.066509 -0.783592 0.617706
vn -0.491905 0.864934 -0.099595
vn 0.375350 -0.440761 -0.815378
vn 0.032546 -0.999392 -0.012486
vn 0.843358 -0.177432 0.507213
vn -0.396118 0.912062 -0.105991
vn -0.255137 0.399695 -0.880425
vn 0.995943 0.089959 0.002152
vn -0.104265 -0.555776 0.824768
vn -0.080495 0.992934 -0.087189
vn 0.165826 0.984438 0.058164
vn -0.759502 0.278314 -0.587961
vn -0.343551 -0.938304 0.039480
vn 0.764897 0.639912 0.073792
vn -0.088769 0.075435 -0.993192
vn -0.228805 -0.601951 0.765051
# 46 normals
usemtl default
f 34/1/34 9/2/9 10/3/10
f 30/4/30 14/5/14 4/6/4
f 26/7/26 2/8/2 28/9/28
f 18/10/18 13/11/13 26/12/26
f 16/13/16 4/14/4 14/15/14
f 31/16/31 35/17/35 20/18/20
f 38/19/38 3/20/3 6/21/6
f 17/22/17 6/23/6 41/24/41
f 7/25/7 11/26/11 37/27/37
f 18/10/18 19/28/19 21/29/21
f 8/30/8 10/3/10 12/31/12
f 22/32/22 38/19/38 6/21/6
f 38/19/38 25/33/25 3/20/3
f 22/34/22 12/31/12 5/35/5
f 39/36/39 34/1/34 10/3/10
f 15/37/15 20/18/20 2/8/2
f 16/13/16 23/38/23 4/14/4
f 42/39/42 32/40/32 4/41/4
f 12/31/12 33/42/33 5/35/5
f 10/3/10 27/43/27 12/31/12
f 39/44/39 2/8/2 26/7/26
f 46/45/46 15/37/15 2/8/2
f 17/22/17 41/24/41 14/5/14
f 25/46/25 14/15/14 3/47/3
f 46/48/46 10/3/10 31/49/31
f 31/49/31 10/3/10 8/30/8
f 45/50/45 37/27/37 23/38/23
f 27/43/27 33/42/33 12/31/12
f 1/51/1 24/52/24 17/22/17
f 32/53/32 30/4/30 4/6/4
f 29/54/29 43/55/43 18/10/18
f 29/54/29 18/10/18 11/56/11
f 18/10/18 26/12/26 19/28/19
f 1/51/1 30/4/30 40/57/40
f 24/52/24 6/23/6 17/22/17
f 35/58/35 6/21/6 44/59/44
f 11/56/11 18/10/18 21/29/21
f 37/27/37 11/26/11 42/60/42
f 8/30/8 12/31/12 22/34/22
f 31/49/31 8/30/8 22/34/22
f 11/56/11 21/29/21 42/39/42
f 42/39/42 21/29/21 32/40/32
f 28/61/28 24/52/24 1/51/1
f 20/18/20 35/17/35 44/62/44
f 25/46/25 16/13/16 14/15/14
f 27/63/27 45/50/45 33/64/33
f 26/65/26 28/61/28 1/51/1
f 26/65/26 1/51/1 36/66/36
f 10/3/10 9/2/9 27/43/27
f 9/67/9 45/50/45 27/63/27
f 20/18/20 44/62/44 28/9/28
f 2/8/2 20/18/20 28/9/28
f 7/25/7 29/68/29 11/26/11
f 43/69/43 29/70/29 7/71/7
f 30/4/30 17/22/17 14/5/14
f 1/51/1 17/22/17 30/4/30
f 46/45/46 31/16/31 15/37/15
f 31/16/31 20/18/20 15/37/15
f 21/29/21 36/72/36 32/40/32
f 36/66/36 1/51/1 40/57/40
f 5/73/5 33/64/33 25/46/25
f 33/64/33 45/50/45 25/46/25
f 43/69/43 7/71/7 34/1/34
f 34/1/34 7/71/7 9/2/9
f 35/58/35 22/32/22 6/21/6
f 31/49/31 22/34/22 35/74/35
f 21/29/21 19/28/19 36/72/36
f 19/28/19 26/12/26 36/72/36
f 9/67/9 7/25/7 37/27/37
f 9/67/9 37/27/37 45/50/45
f 22/32/22 5/75/5 38/19/38
f 5/75/5 25/33/25 38/19/38
f 13/76/13 39/44/39 26/7/26
f 43/55/43 13/11/13 18/10/18
f 36/66/36 40/57/40 32/53/32
f 40/57/40 30/4/30 32/53/32
f 41/24/41 6/23/6 3/77/3
f 41/24/41 3/77/3 14/5/14
f 37/27/37 42/60/42 23/38/23
f 23/38/23 42/60/42 4/14/4
f 43/69/43 39/36/39 13/78/13
f 43/69/43 34/1/34 39/36/39
f 28/61/28 44/79/44 24/52/24
f 24/52/24 44/79/44 6/23/6
f 45/50/45 23/38/23 16/13/16
f 25/46/25 45/50/45 16/13/16
f 46/45/46 2/8/2 39/44/39
f 46/48/46 39/36/39 10/3/10
# 88 faces

+ 1
- 1
IronToad_UnityProject/Assets/Art/Models/catapult_rock.OBJ.meta View File

@ -36,7 +36,7 @@ ModelImporter:
isReadable: 1 isReadable: 1
meshes: meshes:
lODScreenPercentages: [] lODScreenPercentages: []
globalScale: 0.066
globalScale: 1
meshCompression: 0 meshCompression: 0
addColliders: 0 addColliders: 0
importBlendShapes: 1 importBlendShapes: 1

+ 0
- 82
IronToad_UnityProject/Assets/Art/Models/lightHouse_LOW.obj.meta View File

@ -1,82 +0,0 @@
fileFormatVersion: 2
guid: 919eb0dba9aa0da44aec3a80f1cf98ea
timeCreated: 1485000000
licenseType: Free
ModelImporter:
serializedVersion: 19
fileIDToRecycleName:
100000: lighthouse
100002: //RootNode
400000: lighthouse
400002: //RootNode
2300000: lighthouse
3300000: lighthouse
4300000: lighthouse
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: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

+ 0
- 82
IronToad_UnityProject/Assets/Art/Models/pier.obj.meta View File

@ -1,82 +0,0 @@
fileFormatVersion: 2
guid: 37549450629db464abffe54861590cf3
timeCreated: 1485008673
licenseType: Free
ModelImporter:
serializedVersion: 19
fileIDToRecycleName:
100000: pCylinder3
100002: //RootNode
400000: pCylinder3
400002: //RootNode
2300000: pCylinder3
3300000: pCylinder3
4300000: pCylinder3
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: 0
humanoidOversampling: 1
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
IronToad_UnityProject/Assets/Prefabs/catapultExplosion.prefab View File


+ 10
- 0
IronToad_UnityProject/Assets/Scripts/AlertController.cs View File

@ -16,6 +16,7 @@ public class AlertController : MonoBehaviour
{ {
NotificationServer.register("spotted boat", spottedBoat); NotificationServer.register("spotted boat", spottedBoat);
NotificationServer.register("lost boat", lostBoat); NotificationServer.register("lost boat", lostBoat);
NotificationServer.register("restart scene", restartScene);
// originalPos = text.rectTransform.anchoredPosition3D; // originalPos = text.rectTransform.anchoredPosition3D;
} }
@ -49,6 +50,15 @@ public class AlertController : MonoBehaviour
}); });
} }
public void restartScene()
{
LeanTween.cancel(text.gameObject, false);
LeanTween.cancel(slider.gameObject, false);
NotificationServer.notify("hide AlertText");
NotificationServer.notify("hide AlertTimer");
}
public void setTimer(float val) public void setTimer(float val)
{ {
slider.value = val; slider.value = val;

+ 6
- 1
IronToad_UnityProject/Assets/Scripts/AudioController.cs View File

@ -59,6 +59,7 @@ public class AudioController : MonoBehaviour
{ {
if (Searchlight.state == Searchlight.SearchState.Chasing) if (Searchlight.state == Searchlight.SearchState.Chasing)
{ {
NotificationServer.notify("play sfx", "spottedDialogue:0.9");
NotificationServer.notify("play sfx", "shipSpotted:0.5"); NotificationServer.notify("play sfx", "shipSpotted:0.5");
// NotificationServer.notify("play sfx", "spottedDialogue"); // NotificationServer.notify("play sfx", "spottedDialogue");
NotificationServer.notify("play bgm", "attack:9"); NotificationServer.notify("play bgm", "attack:9");
@ -154,6 +155,7 @@ public class AudioController : MonoBehaviour
s.clip = clip; s.clip = clip;
s.volume = volume; s.volume = volume;
s.Play(); s.Play();
return;
} }
} }
} }
@ -221,7 +223,10 @@ public class AudioController : MonoBehaviour
{ {
LeanTween.cancel(foundEmpty.gameObject); LeanTween.cancel(foundEmpty.gameObject);
foundEmpty.clip = clip; foundEmpty.clip = clip;
foundEmpty.timeSamples = timeSamples;
if (timeSamples < foundEmpty.clip.samples)
foundEmpty.timeSamples = timeSamples;
else
foundEmpty.timeSamples = 0;
foundEmpty.Play(); foundEmpty.Play();
LeanTween.value(foundEmpty.gameObject, foundEmpty.volume, volume, 1f).setOnUpdate((float val)=>{ LeanTween.value(foundEmpty.gameObject, foundEmpty.volume, volume, 1f).setOnUpdate((float val)=>{
foundEmpty.volume = val; foundEmpty.volume = val;

+ 4
- 1
IronToad_UnityProject/Assets/Scripts/BoatController.cs View File

@ -29,6 +29,8 @@ public class BoatController : BuoyantObject {
// Update is called once per frame // Update is called once per frame
void lookAtDir(Vector3 inputDir) { void lookAtDir(Vector3 inputDir) {
if (inputDir == Vector3.zero)
return;
Quaternion targetRotation = Quaternion.LookRotation(inputDir, Vector3.up); Quaternion targetRotation = Quaternion.LookRotation(inputDir, Vector3.up);
float str = Mathf.Min(trunSpeed * Time.deltaTime, 1); float str = Mathf.Min(trunSpeed * Time.deltaTime, 1);
transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, str); transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, str);
@ -39,8 +41,9 @@ public class BoatController : BuoyantObject {
float forwardHitSpeed = Vector3.Project(collision.relativeVelocity, transform.forward).magnitude; float forwardHitSpeed = Vector3.Project(collision.relativeVelocity, transform.forward).magnitude;
Debug.Log("Forward hit:" + forwardHitSpeed);
// Debug.Log("Forward hit:" + forwardHitSpeed);
if (forwardHitSpeed > breakSpeed) { if (forwardHitSpeed > breakSpeed) {
NotificationServer.notify("play sfx", "runAground:1");
PlayerController.instance.takeOneDamage(); PlayerController.instance.takeOneDamage();
} }
} }

+ 23
- 2
IronToad_UnityProject/Assets/Scripts/Boulder.cs View File

@ -6,7 +6,14 @@ public class Boulder : HeavyObject
{ {
public GameObject splash; public GameObject splash;
public GameObject Explosion; public GameObject Explosion;
private int transparentLayer;
void Awake()
{
transparentLayer = LayerMask.NameToLayer("TransparentFX");
}
public override void OnWaterStay(WaterController water,float waveHeight) public override void OnWaterStay(WaterController water,float waveHeight)
{ {
} }
@ -16,11 +23,25 @@ public class Boulder : HeavyObject
} }
void OnTriggerEnter(Collider other) { void OnTriggerEnter(Collider other) {
if (other.gameObject.CompareTag("Water")) {
if (other.gameObject.layer == transparentLayer)
return;
if (other.gameObject.CompareTag("Water"))
{
NotificationServer.notify("play sfx", "rockWater_3:0.8");
Destroy(Instantiate(splash, transform.position,Quaternion.identity), 2.5f); Destroy(Instantiate(splash, transform.position,Quaternion.identity), 2.5f);
}else {
}
else if (other.gameObject.CompareTag("Player"))
{
NotificationServer.notify("play sfx", "runAground:1");
Destroy(Instantiate(Explosion, transform.position, Quaternion.identity), 6);
PlayerController.instance.takeOneDamage();
}
else
{
NotificationServer.notify("play sfx", "runAground:1");
Destroy(Instantiate(Explosion, transform.position, Quaternion.identity), 6); Destroy(Instantiate(Explosion, transform.position, Quaternion.identity), 6);
} }
NotificationServer.notify("BoulderHit");
} }

+ 13
- 1
IronToad_UnityProject/Assets/Scripts/Catapult.cs View File

@ -23,17 +23,21 @@ public class Catapult : MonoBehaviour
private BGCcCursorObjectTranslate splineObjectTranslate; private BGCcCursorObjectTranslate splineObjectTranslate;
private Vector3 originalScale; private Vector3 originalScale;
private MeshRenderer meshRenderer; private MeshRenderer meshRenderer;
private ParticleSystem particleSystem;
void Start () void Start ()
{ {
splineCursor = splineCurve.GetComponent<BGCcCursor>(); splineCursor = splineCurve.GetComponent<BGCcCursor>();
splineObjectTranslate = splineCurve.GetComponent<BGCcCursorObjectTranslate>(); splineObjectTranslate = splineCurve.GetComponent<BGCcCursorObjectTranslate>();
meshRenderer = splineObjectTranslate.ObjectToManipulate.GetComponent<MeshRenderer>(); meshRenderer = splineObjectTranslate.ObjectToManipulate.GetComponent<MeshRenderer>();
particleSystem = splineObjectTranslate.ObjectToManipulate.GetComponentInChildren<ParticleSystem>();
meshRenderer.enabled = false; meshRenderer.enabled = false;
particleSystem.Stop();
originalScale = splineCurve.transform.parent.localScale; originalScale = splineCurve.transform.parent.localScale;
NotificationServer.register("statechange Searchlight", searchlightStateChanged); NotificationServer.register("statechange Searchlight", searchlightStateChanged);
NotificationServer.register("BoulderHit", boulderHit);
} }
void Update() void Update()
@ -48,6 +52,11 @@ public class Catapult : MonoBehaviour
launchBoulder(); launchBoulder();
} }
public void boulderHit()
{
LeanTween.cancel(splineObjectTranslate.ObjectToManipulate.gameObject, true);
}
public void launchBoulder() public void launchBoulder()
{ {
if (Searchlight.state != Searchlight.SearchState.Chasing || isLaunching) if (Searchlight.state != Searchlight.SearchState.Chasing || isLaunching)
@ -63,6 +72,7 @@ public class Catapult : MonoBehaviour
isLaunching = false; isLaunching = false;
return; return;
} }
particleSystem.Stop();
meshRenderer.enabled = true; meshRenderer.enabled = true;
splineCursor.DistanceRatio = 0f; splineCursor.DistanceRatio = 0f;
splineCurve.transform.parent.position = player.position splineCurve.transform.parent.position = player.position
@ -70,12 +80,14 @@ public class Catapult : MonoBehaviour
+ Vector3.forward * Random.Range(-randomFactor, randomFactor); + Vector3.forward * Random.Range(-randomFactor, randomFactor);
splineCurve.transform.parent.localEulerAngles = Vector3.up * Random.Range(0f, 360f); splineCurve.transform.parent.localEulerAngles = Vector3.up * Random.Range(0f, 360f);
splineCurve.transform.parent.localScale = new Vector3(Random.Range(minScale * originalScale.x, maxScale * originalScale.x), originalScale.y, originalScale.z); splineCurve.transform.parent.localScale = new Vector3(Random.Range(minScale * originalScale.x, maxScale * originalScale.x), originalScale.y, originalScale.z);
particleSystem.Play();
LeanTween.value(splineObjectTranslate.ObjectToManipulate.gameObject, 0f, 1f, splineCursor.Math.GetDistance() / speed) LeanTween.value(splineObjectTranslate.ObjectToManipulate.gameObject, 0f, 1f, splineCursor.Math.GetDistance() / speed)
.setEase(animationCurve) .setEase(animationCurve)
.setOnUpdate((float val)=>{ .setOnUpdate((float val)=>{
splineCursor.DistanceRatio = val; splineCursor.DistanceRatio = val;
}).setOnComplete(()=>{ }).setOnComplete(()=>{
splineCursor.DistanceRatio = 0f;
particleSystem.Stop();
// splineCursor.DistanceRatio = 0f;
isLaunching = false; isLaunching = false;
meshRenderer.enabled = false; meshRenderer.enabled = false;
launchBoulder(); launchBoulder();

+ 1
- 1
IronToad_UnityProject/Assets/Scripts/HeavyObject.cs View File

@ -9,7 +9,7 @@ public abstract class HeavyObject : WaterObject {
public float splashPower; public float splashPower;
public override void OnWaterEnter(WaterController water) { public override void OnWaterEnter(WaterController water) {
Debug.Log ("creating wave");
// Debug.Log ("creating wave");
water.CreateWave (transform.position, splashRadius, splashPower); water.CreateWave (transform.position, splashRadius, splashPower);
} }

+ 2
- 2
IronToad_UnityProject/Assets/Scripts/HidingSpot.cs View File

@ -19,7 +19,7 @@ public class HidingSpot : MonoBehaviour {
void OnTriggerEnter(Collider other) { void OnTriggerEnter(Collider other) {
if (other.gameObject.CompareTag("Player")) { if (other.gameObject.CompareTag("Player")) {
Searchlight.playerHidden = true; Searchlight.playerHidden = true;
Debug.Log("player here");
// Debug.Log("player here");
} }
} }
@ -27,7 +27,7 @@ public class HidingSpot : MonoBehaviour {
void OnTriggerExit(Collider other) { void OnTriggerExit(Collider other) {
if (other.gameObject.CompareTag("Player")) { if (other.gameObject.CompareTag("Player")) {
Searchlight.playerHidden = false; Searchlight.playerHidden = false;
Debug.Log("player exit");
// Debug.Log("player exit");
} }
} }
} }

+ 15
- 0
IronToad_UnityProject/Assets/Scripts/Lighthouse.cs View File

@ -41,6 +41,7 @@ public class Lighthouse : MonoBehaviour
moveToNextPoint(); moveToNextPoint();
NotificationServer.register("statechange Searchlight", searchlightStateChanged); NotificationServer.register("statechange Searchlight", searchlightStateChanged);
NotificationServer.register("restart scene", restartScene);
} }
public void moveToNextPoint() public void moveToNextPoint()
@ -104,4 +105,18 @@ public class Lighthouse : MonoBehaviour
}); });
} }
} }
public void restartScene()
{
LeanTween.cancel(gameObject, false);
Searchlight.state = Searchlight.SearchState.Spline;
splineObjectTranslate.enabled = true;
splineCursor.Distance = 0f;
midpoint = false;
reverseDirection = false;
targetPoint = 0;
splineObjectTranslate.ObjectToManipulate.position = splineCursor.CalculatePosition();
moveToNextPoint();
NotificationServer.notify("statechange Searchlight safe");
}
} }

+ 5
- 4
IronToad_UnityProject/Assets/Scripts/PlayerController.cs View File

@ -37,7 +37,7 @@ public class PlayerController : MonoBehaviour {
void Update () { void Update () {
if (Input.GetButtonDown("Fire1") && !isLocked) { if (Input.GetButtonDown("Fire1") && !isLocked) {
Debug.Log("Click");
// Debug.Log("Click");
RaycastHit hit; RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
@ -50,7 +50,7 @@ public class PlayerController : MonoBehaviour {
WaterController waterScript = hit.collider.gameObject.GetComponent<WaterController>(); WaterController waterScript = hit.collider.gameObject.GetComponent<WaterController>();
Debug.DrawLine(Camera.main.transform.position, hit.point, Color.red,1); Debug.DrawLine(Camera.main.transform.position, hit.point, Color.red,1);
Debug.Log("I hit: " + hit.transform.name);
// Debug.Log("I hit: " + hit.transform.name);
if (waterScript != null) if (waterScript != null)
waterScript.CreateWave(hit.point, radius, power); waterScript.CreateWave(hit.point, radius, power);
@ -79,12 +79,12 @@ public class PlayerController : MonoBehaviour {
private void showGameUI() { private void showGameUI() {
Debug.Log("UI open");
// Debug.Log("UI open");
isLocked = false; isLocked = false;
} }
private void hideGameUI() { private void hideGameUI() {
Debug.Log("UI close");
// Debug.Log("UI close");
isLocked = true; isLocked = true;
} }
@ -92,6 +92,7 @@ public class PlayerController : MonoBehaviour {
setLife(3); setLife(3);
boat.transform.position = startPoint; boat.transform.position = startPoint;
boat.GetComponent<Rigidbody>().velocity = Vector3.zero; boat.GetComponent<Rigidbody>().velocity = Vector3.zero;
NotificationServer.notify("restart scene");
} }
} }

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

@ -41,7 +41,7 @@ public class WaterController : MonoBehaviour {
/// <param name="radius"> radius of effected object</param> /// <param name="radius"> radius of effected object</param>
/// <param name="power"> power with chich the objects are pushed</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) {
// NotificationServer.notify("play sfx", "createWave:0.2");
NotificationServer.notify("play sfx", "createWave_3:0.2");
//find all colliders within the wave distance //find all colliders within the wave distance
@ -80,7 +80,6 @@ public class WaterController : MonoBehaviour {
private 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; float elapsedTime = 0.0f;
while (elapsedTime < rippleTime) { while (elapsedTime < rippleTime) {

+ 0
- 0
IronToad_UnityProject/Assets/Shaders/TwoToneDiffuse.shader View File


+ 0
- 0
IronToad_UnityProject/Assets/Shaders/TwoToneDiffuse.shader.meta View File


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


Loading…
Cancel
Save