diff --git a/IronToad_UnityProject/Assets/Art/Models/pier.obj.meta b/IronToad_UnityProject/Assets/Art/Models/pier.obj.meta deleted file mode 100644 index 92a0183..0000000 --- a/IronToad_UnityProject/Assets/Art/Models/pier.obj.meta +++ /dev/null @@ -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: diff --git a/IronToad_UnityProject/Assets/Prefabs/boatCollisionParticle.prefab b/IronToad_UnityProject/Assets/Prefabs/boatCollisionParticle.prefab new file mode 100644 index 0000000..f40b4d2 Binary files /dev/null and b/IronToad_UnityProject/Assets/Prefabs/boatCollisionParticle.prefab differ diff --git a/IronToad_UnityProject/Assets/Prefabs/boatCollisionParticle.prefab.meta b/IronToad_UnityProject/Assets/Prefabs/boatCollisionParticle.prefab.meta new file mode 100644 index 0000000..84b563e --- /dev/null +++ b/IronToad_UnityProject/Assets/Prefabs/boatCollisionParticle.prefab.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 785489b73767a41c49ff69b387dd4ddc +timeCreated: 1485044195 +licenseType: Pro +NativeFormatImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Scripts/BoatController.cs b/IronToad_UnityProject/Assets/Scripts/BoatController.cs index 6d1b846..32305b3 100644 --- a/IronToad_UnityProject/Assets/Scripts/BoatController.cs +++ b/IronToad_UnityProject/Assets/Scripts/BoatController.cs @@ -15,7 +15,7 @@ public class BoatController : BuoyantObject { // Use this for initialization void Start() { - + NotificationServer.register("switch off", switchOff); } void Update() { @@ -85,7 +85,10 @@ public class BoatController : BuoyantObject { applyBreak = true; } - + private void switchOff(object _) + { + rb.velocity = Vector3.zero; + } } diff --git a/IronToad_UnityProject/Assets/Scripts/CustomSmoothFollow.cs b/IronToad_UnityProject/Assets/Scripts/CustomSmoothFollow.cs index ee23660..dfe58cf 100644 --- a/IronToad_UnityProject/Assets/Scripts/CustomSmoothFollow.cs +++ b/IronToad_UnityProject/Assets/Scripts/CustomSmoothFollow.cs @@ -14,11 +14,16 @@ public class CustomSmoothFollow : MonoBehaviour private int layerMask; [Range (0,360)] public float offsetAngle = 90; + public float shakeStrength = 5f; + + private float shakeCurrent; // Use this for initialization void Start() { layerMask = LayerMask.NameToLayer(layerToMask); + + NotificationServer.register("shake camera", shake); } // Update is called once per frame @@ -74,18 +79,24 @@ public class CustomSmoothFollow : MonoBehaviour // Set the height of the camera transform.position = new Vector3(currentSide, currentHeight, currentDistance); + if (shakeCurrent > 0f) + { + transform.position += Random.insideUnitSphere * shakeStrength; + shakeCurrent -= Time.deltaTime * shakeStrength; + } // Always look at the target Vector3 lookTarget = target.position; lookTarget.z = transform.position.z; transform.LookAt(lookTarget); + } - - - + public void shake() + { + shakeCurrent = shakeStrength; } - private Vector3 RotatePointAroundPivot(Vector3 point,Vector3 pivot,float angles ) { + private Vector3 RotatePointAroundPivot(Vector3 point,Vector3 pivot,float angles ){ Vector3 dir = point - pivot; // get point direction relative to pivot dir = Quaternion.Euler(angles * Vector3.up) * dir; // rotate it point = dir + pivot; // calculate rotated point diff --git a/IronToad_UnityProject/Assets/Scripts/LightBeam.cs b/IronToad_UnityProject/Assets/Scripts/LightBeam.cs index b857d0d..9c61b15 100644 --- a/IronToad_UnityProject/Assets/Scripts/LightBeam.cs +++ b/IronToad_UnityProject/Assets/Scripts/LightBeam.cs @@ -31,8 +31,13 @@ public class LightBeam : MonoBehaviour { GetComponent().SetBool("isSeen", false); } - private void switchOff() { - lightBeam.gameObject.SetActive(false); - target.gameObject.SetActive(false); + private void switchOff(object offObject) { + GameObject offGO = offObject as GameObject; +// Debug.LogWarning(offGO + " vs " + gameObject); + if (offGO == gameObject) + { + lightBeam.gameObject.SetActive(false); + target.gameObject.SetActive(false); + } } } diff --git a/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs b/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs index 5f7bac2..9f549c6 100644 --- a/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs +++ b/IronToad_UnityProject/Assets/Scripts/LighthouseLanding.cs @@ -8,9 +8,12 @@ public class LighthouseLanding : MonoBehaviour private bool isTriggering = false; + static private Transform lastTriggered; + void Awake() { NotificationServer.register("statechange Searchlight", searchlightStateChanged); + NotificationServer.register("switch off", switchBeamOff); } void OnTriggerEnter(Collider other) @@ -26,6 +29,7 @@ public class LighthouseLanding : MonoBehaviour isTriggering = true; NotificationServer.notify("show TakeoverButton"); + lastTriggered = transform; } void OnTriggerExit(Collider other) @@ -54,9 +58,14 @@ public class LighthouseLanding : MonoBehaviour public void switchOff() { - switchedOff = true; NotificationServer.notify("hide TakeoverButton"); NotificationServer.notify("play sfx", "assassination:0.75"); - NotificationServer.notify("switch off"); + NotificationServer.notify("switch off", lastTriggered.parent.gameObject); } + + public void switchBeamOff(object _) + { + if (transform == lastTriggered) + switchedOff = true; + } } diff --git a/IronToad_UnityProject/Assets/Scripts/PlayerController.cs b/IronToad_UnityProject/Assets/Scripts/PlayerController.cs index 9a4fcae..ebac487 100644 --- a/IronToad_UnityProject/Assets/Scripts/PlayerController.cs +++ b/IronToad_UnityProject/Assets/Scripts/PlayerController.cs @@ -3,7 +3,8 @@ using System.Collections.Generic; using UnityEngine; public class PlayerController : MonoBehaviour { - + public float cooldownWaveCreate = 0.5f; + private float timeOfLastWave; public bool isLocked = false; public float power; @@ -11,6 +12,7 @@ public class PlayerController : MonoBehaviour { public float time; public GameObject waveRing; + public ParticleSystem boatHitParticle; public int life = 3; public float lastDamageTime = 0; @@ -37,6 +39,11 @@ public class PlayerController : MonoBehaviour { void Update () { if (Input.GetButtonDown("Fire1") && !isLocked) { + + if (cooldownWaveCreate > Time.timeSinceLevelLoad - timeOfLastWave) + return; + + timeOfLastWave = Time.timeSinceLevelLoad; // Debug.Log("Click"); RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); @@ -69,6 +76,9 @@ public class PlayerController : MonoBehaviour { } public void takeOneDamage() { +// NotificationServer.notify("shake camera"); + NotificationServer.notify("flash damage"); + boatHitParticle.Play(); if (Time.time > lastDamageTime + 2 && life > 0) { setLife(life - 1); lastDamageTime = Time.time; @@ -76,7 +86,7 @@ public class PlayerController : MonoBehaviour { { NotificationServer.notify("fade bgm"); NotificationServer.notify("play sfx", "shipSpotted:0.5"); - NotificationServer.notify("play sfx", "sinkingShip:0.75"); + NotificationServer.notify("play sfx", "sinkingShip_2:0.75"); NotificationServer.notify("show GameOverPanel"); NotificationServer.notify("hide GameUI"); } diff --git a/IronToad_UnityProject/Assets/Scripts/ScreenEffects.cs b/IronToad_UnityProject/Assets/Scripts/ScreenEffects.cs index 8618b3c..475973f 100644 --- a/IronToad_UnityProject/Assets/Scripts/ScreenEffects.cs +++ b/IronToad_UnityProject/Assets/Scripts/ScreenEffects.cs @@ -7,10 +7,13 @@ public class ScreenEffects : MonoBehaviour { public DepthOfField depthOfField; public float strength = 0f; + public CanvasGroup flashCanvas; private float originalNearRadius; private float originalFarRadius; + private int flashID; + void Start () { depthOfField = GetComponent(); @@ -21,6 +24,7 @@ public class ScreenEffects : MonoBehaviour NotificationServer.register("show GameUI", showGame); NotificationServer.register("hide GameUI", hideGame); + NotificationServer.register("flash damage", flashDamage); } public void showGame() @@ -51,4 +55,11 @@ public class ScreenEffects : MonoBehaviour }).setIgnoreTimeScale(true); } + public void flashDamage() + { + LeanTween.cancel(flashID); + flashID = LeanTween.alphaCanvas(flashCanvas, 1f, 0.2f).setEaseInOutCubic().setOnComplete(()=>{ + LeanTween.alphaCanvas(flashCanvas, 0f, 0.6f).setEaseInOutCubic(); + }).uniqueId; + } } diff --git a/IronToad_UnityProject/Assets/Scripts/Searchlight.cs b/IronToad_UnityProject/Assets/Scripts/Searchlight.cs index a2dce54..f83985b 100644 --- a/IronToad_UnityProject/Assets/Scripts/Searchlight.cs +++ b/IronToad_UnityProject/Assets/Scripts/Searchlight.cs @@ -40,6 +40,7 @@ public class Searchlight : MonoBehaviour { NotificationServer.register("statechange Searchlight safe", stateSafe); NotificationServer.register("statechange Searchlight returning", stateReturning); + NotificationServer.register("spotted boat", spottedBoat); if (!instants.Contains(this)) instants.Add(this); @@ -50,7 +51,6 @@ public class Searchlight : MonoBehaviour if (other.tag != "Player" || playerHidden ) return; chased = other; - isTriggering = true; if (state != SearchState.Chasing) { state = SearchState.Chasing; @@ -58,7 +58,6 @@ public class Searchlight : MonoBehaviour NotificationServer.notify("chasing boat"); } LeanTween.cancel(gameObject, false); - LeanTween.move(gameObject, chased.transform.position, 0.5f).setEase(animationCurve).setOnComplete(chase); NotificationServer.notify("spotted boat"); } @@ -95,6 +94,12 @@ public class Searchlight : MonoBehaviour // LeanTween.move(gameObject, chased.transform.position, 0.5f).setEase(animationCurve).setOnComplete(chase); } + public void spottedBoat() + { + isTriggering = true; + LeanTween.move(gameObject, chased.transform.position, 0.5f).setEase(animationCurve).setOnComplete(chase); + } + public void chase() { if (isTriggering) diff --git a/IronToad_UnityProject/Assets/Scripts/UIPanel.cs b/IronToad_UnityProject/Assets/Scripts/UIPanel.cs index 8df274b..239883e 100644 --- a/IronToad_UnityProject/Assets/Scripts/UIPanel.cs +++ b/IronToad_UnityProject/Assets/Scripts/UIPanel.cs @@ -175,4 +175,14 @@ public class UIPanel : MonoBehaviour { Time.timeScale = 1f; } + + public void disableObject(GameObject go) + { + go.SetActive(false); + } + + public void enableObject(GameObject go) + { + go.SetActive(true); + } } diff --git a/IronToad_UnityProject/Assets/Scripts/VictoryScript.cs b/IronToad_UnityProject/Assets/Scripts/VictoryScript.cs new file mode 100644 index 0000000..82c63ea --- /dev/null +++ b/IronToad_UnityProject/Assets/Scripts/VictoryScript.cs @@ -0,0 +1,49 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class VictoryScript : MonoBehaviour +{ + private bool isTriggering = false; + + void OnTriggerEnter(Collider other) + { + if (other.tag != "Player") + return; + if (Searchlight.state == Searchlight.SearchState.Chasing) + return; + if (isTriggering) + return; + + isTriggering = true; + NotificationServer.notify("show VictoryButton"); + } + + void OnTriggerExit(Collider other) + { + if (other.tag != "Player") + return; + if (!isTriggering) + return; + + isTriggering = false; + NotificationServer.notify("hide VictoryButton"); + } + + void searchlightStateChanged() + { + if (isTriggering && Searchlight.state == Searchlight.SearchState.Chasing) + { + isTriggering = false; + NotificationServer.notify("hide VictoryButton"); + } + } + + public void victoryClicked() + { + NotificationServer.notify("fade bgm"); + NotificationServer.notify("play sfx", "shipSpotted_2:0.5"); + NotificationServer.notify("show VictoryPanel"); + NotificationServer.notify("hide GameUI"); + } +} diff --git a/IronToad_UnityProject/Assets/Scripts/VictoryScript.cs.meta b/IronToad_UnityProject/Assets/Scripts/VictoryScript.cs.meta new file mode 100644 index 0000000..3b22bee --- /dev/null +++ b/IronToad_UnityProject/Assets/Scripts/VictoryScript.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7570fcc436e7c471f9503908ba3e4e97 +timeCreated: 1486802138 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Scripts/WaterController.cs b/IronToad_UnityProject/Assets/Scripts/WaterController.cs index 28d3457..a3158a3 100644 --- a/IronToad_UnityProject/Assets/Scripts/WaterController.cs +++ b/IronToad_UnityProject/Assets/Scripts/WaterController.cs @@ -48,7 +48,7 @@ public class WaterController : MonoBehaviour { point.y = transform.position.y; Vector3 pos = point; - pos.y += 1; + pos.y += 6f; Quaternion rot = Quaternion.Euler(-90, 0, 0); if (rippleEffect != null) { diff --git a/IronToad_UnityProject/Assets/Sound.meta~9aa76cf59aefcb5184922037951a67f20abdf40d b/IronToad_UnityProject/Assets/Sound.meta~9aa76cf59aefcb5184922037951a67f20abdf40d deleted file mode 100644 index f8e9b50..0000000 --- a/IronToad_UnityProject/Assets/Sound.meta~9aa76cf59aefcb5184922037951a67f20abdf40d +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: 844c4f25011b45348a5db5bc5b4f956e -folderAsset: yes -timeCreated: 1485037848 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Sound.meta~9aa76cf59aefcb5184922037951a67f20abdf40d.meta b/IronToad_UnityProject/Assets/Sound.meta~9aa76cf59aefcb5184922037951a67f20abdf40d.meta deleted file mode 100644 index 4a5a01d..0000000 --- a/IronToad_UnityProject/Assets/Sound.meta~9aa76cf59aefcb5184922037951a67f20abdf40d.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 4f48e22f51b6449849bfe949e93bd014 -timeCreated: 1485054810 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Sound.meta~HEAD_0 b/IronToad_UnityProject/Assets/Sound.meta~HEAD_0 deleted file mode 100644 index 9d54175..0000000 --- a/IronToad_UnityProject/Assets/Sound.meta~HEAD_0 +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: e3b0c439ea6f28c4fb3ce6bc58682b6b -folderAsset: yes -timeCreated: 1485052873 -licenseType: Pro -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/Sound.meta~HEAD_0.meta b/IronToad_UnityProject/Assets/Sound.meta~HEAD_0.meta deleted file mode 100644 index 071e2a5..0000000 --- a/IronToad_UnityProject/Assets/Sound.meta~HEAD_0.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: c4dadf9d2dcd00b41a75fe2f9e83af94 -timeCreated: 1485059760 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/IronToad_UnityProject/Assets/_Scenes/IGDA_Lighthouse.unity b/IronToad_UnityProject/Assets/_Scenes/IGDA_Lighthouse.unity index f6f30d2..2c9b024 100644 Binary files a/IronToad_UnityProject/Assets/_Scenes/IGDA_Lighthouse.unity and b/IronToad_UnityProject/Assets/_Scenes/IGDA_Lighthouse.unity differ diff --git a/IronToad_UnityProject/ProjectSettings/EditorBuildSettings.asset b/IronToad_UnityProject/ProjectSettings/EditorBuildSettings.asset index 6b50922..c96132f 100644 Binary files a/IronToad_UnityProject/ProjectSettings/EditorBuildSettings.asset and b/IronToad_UnityProject/ProjectSettings/EditorBuildSettings.asset differ