diff --git a/SurvivalIsland/Assets/Scripts/DoorManager.cs b/SurvivalIsland/Assets/Scripts/DoorManager.cs new file mode 100644 index 0000000..4f63334 --- /dev/null +++ b/SurvivalIsland/Assets/Scripts/DoorManager.cs @@ -0,0 +1,46 @@ +using UnityEngine; +using System.Collections; + +public class DoorManager : MonoBehaviour +{ + bool doorIsOpen = false; + float doorTimer = 0.0f; + public float doorOpenTime = 3.0f; + public AudioClip doorOpenSound; + public AudioClip doorShutSound; + + // Use this for initialization + void Start() + { + doorTimer = 0.0f; + } + + // Update is called once per frame + void Update() + { + if (doorIsOpen) + { + doorTimer += Time.deltaTime; + if (doorTimer > doorOpenTime) + { + Door(doorShutSound, false, "doorshut"); + doorTimer = 0.0f; + } + } + } + + void DoorCheck() + { + if (!doorIsOpen) + { + Door(doorOpenSound, true, "dooropen"); + } + } + + void Door(AudioClip aClip, bool openCheck, string animName) + { + audio.PlayOneShot(aClip); + doorIsOpen = openCheck; + transform.parent.animation.Play(animName); + } +} diff --git a/SurvivalIsland/Assets/Scripts/DoorManager.cs.meta b/SurvivalIsland/Assets/Scripts/DoorManager.cs.meta new file mode 100644 index 0000000..2a323db --- /dev/null +++ b/SurvivalIsland/Assets/Scripts/DoorManager.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 28c1dfaf4ab0da34590fb036ccc994c1 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/SurvivalIsland/Assets/Scripts/PlayerCollisions.cs b/SurvivalIsland/Assets/Scripts/PlayerCollisions.cs index 647b356..8156052 100644 --- a/SurvivalIsland/Assets/Scripts/PlayerCollisions.cs +++ b/SurvivalIsland/Assets/Scripts/PlayerCollisions.cs @@ -2,11 +2,11 @@ using System.Collections; public class PlayerCollisions : MonoBehaviour { - bool doorIsOpen = false; - float doorTimer = 0.0f; - public float doorOpenTime = 3.0f; - public AudioClip doorOpenSound; - public AudioClip doorShutSound; + // bool doorIsOpen = false; + // float doorTimer = 0.0f; + // public float doorOpenTime = 3.0f; + // public AudioClip doorOpenSound; + // public AudioClip doorShutSound; GameObject currentDoor; @@ -17,26 +17,33 @@ public class PlayerCollisions : MonoBehaviour { // Update is called once per frame void Update () { - if (doorIsOpen) { - doorTimer += Time.deltaTime; - - if (doorTimer > doorOpenTime) { - Door (doorShutSound, false, "doorshut",currentDoor); - doorTimer = 0.0f; + RaycastHit hit; + if (Physics.Raycast (transform.position, transform.forward, out hit, 3)) { + if (hit.collider.gameObject.tag == "playerDoor") { + currentDoor = hit.collider.gameObject; + currentDoor.SendMessage ("DoorCheck"); } } + // if (doorIsOpen) { + // doorTimer += Time.deltaTime; + + // if (doorTimer > doorOpenTime) { + // Door (doorShutSound, false, "doorshut",currentDoor); + // doorTimer = 0.0f; + // } + // } } - void OnControllerColliderHit(ControllerColliderHit hit) { - if (hit.gameObject.tag == "playerDoor" && doorIsOpen == false) { - currentDoor = hit.gameObject; - Door (doorOpenSound, true, "dooropen",currentDoor); - } - } + // void OnControllerColliderHit(ControllerColliderHit hit) { + // if (hit.gameObject.tag == "playerDoor" && doorIsOpen == false) { + // currentDoor = hit.gameObject; + // Door (doorOpenSound, true, "dooropen",currentDoor); + // } + // } - void Door(AudioClip aClip, bool openCheck, string animName,GameObject thisDoor) { - thisDoor.audio.PlayOneShot (aClip); - doorIsOpen = openCheck; - thisDoor.transform.parent.animation.Play (animName); - } + // void Door(AudioClip aClip, bool openCheck, string animName,GameObject thisDoor) { + // thisDoor.audio.PlayOneShot (aClip); + // doorIsOpen = openCheck; + // thisDoor.transform.parent.animation.Play (animName); + // } } diff --git a/SurvivalIsland/Assets/Scripts/TriggerZone.cs b/SurvivalIsland/Assets/Scripts/TriggerZone.cs new file mode 100644 index 0000000..d91b322 --- /dev/null +++ b/SurvivalIsland/Assets/Scripts/TriggerZone.cs @@ -0,0 +1,13 @@ +using UnityEngine; +using System.Collections; + +public class TriggerZone : MonoBehaviour +{ + void OnTriggerEnter(Collider col) + { + if (col.gameObject.tag == "Player") + { + transform.FindChild("door").SendMessage("DoorCheck"); + } + } +} diff --git a/SurvivalIsland/Assets/Scripts/TriggerZone.cs.meta b/SurvivalIsland/Assets/Scripts/TriggerZone.cs.meta new file mode 100644 index 0000000..b0e1c8d --- /dev/null +++ b/SurvivalIsland/Assets/Scripts/TriggerZone.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 96b2117e72a038e41acc5be055c9c5f9 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/SurvivalIsland/Assets/SurvivalIsland.unity b/SurvivalIsland/Assets/SurvivalIsland.unity index 514d9ea..c6e5d24 100644 Binary files a/SurvivalIsland/Assets/SurvivalIsland.unity and b/SurvivalIsland/Assets/SurvivalIsland.unity differ diff --git a/SurvivalIsland/Library/CurrentLayout.dwlt b/SurvivalIsland/Library/CurrentLayout.dwlt index dd5ec89..72634a7 100644 Binary files a/SurvivalIsland/Library/CurrentLayout.dwlt and b/SurvivalIsland/Library/CurrentLayout.dwlt differ diff --git a/SurvivalIsland/Library/CurrentMaximizeLayout.dwlt b/SurvivalIsland/Library/CurrentMaximizeLayout.dwlt index 9a341bd..97d4314 100644 Binary files a/SurvivalIsland/Library/CurrentMaximizeLayout.dwlt and b/SurvivalIsland/Library/CurrentMaximizeLayout.dwlt differ diff --git a/SurvivalIsland/Library/ScriptAssemblies/Assembly-CSharp-Editor.dll b/SurvivalIsland/Library/ScriptAssemblies/Assembly-CSharp-Editor.dll index 4049ca9..6732f8e 100644 Binary files a/SurvivalIsland/Library/ScriptAssemblies/Assembly-CSharp-Editor.dll and b/SurvivalIsland/Library/ScriptAssemblies/Assembly-CSharp-Editor.dll differ diff --git a/SurvivalIsland/Library/ScriptAssemblies/Assembly-CSharp.dll b/SurvivalIsland/Library/ScriptAssemblies/Assembly-CSharp.dll index 714e3bd..7d0ec3f 100644 Binary files a/SurvivalIsland/Library/ScriptAssemblies/Assembly-CSharp.dll and b/SurvivalIsland/Library/ScriptAssemblies/Assembly-CSharp.dll differ diff --git a/SurvivalIsland/Library/assetDatabase3 b/SurvivalIsland/Library/assetDatabase3 index 76ac85c..a808781 100644 Binary files a/SurvivalIsland/Library/assetDatabase3 and b/SurvivalIsland/Library/assetDatabase3 differ diff --git a/SurvivalIsland/Library/expandedItems b/SurvivalIsland/Library/expandedItems index 49d6afc..ac537dc 100644 Binary files a/SurvivalIsland/Library/expandedItems and b/SurvivalIsland/Library/expandedItems differ diff --git a/SurvivalIsland/Library/guidmapper b/SurvivalIsland/Library/guidmapper index f1848df..2571826 100644 Binary files a/SurvivalIsland/Library/guidmapper and b/SurvivalIsland/Library/guidmapper differ diff --git a/SurvivalIsland/Library/metadata/28/28c1dfaf4ab0da34590fb036ccc994c1 b/SurvivalIsland/Library/metadata/28/28c1dfaf4ab0da34590fb036ccc994c1 new file mode 100644 index 0000000..96661cc Binary files /dev/null and b/SurvivalIsland/Library/metadata/28/28c1dfaf4ab0da34590fb036ccc994c1 differ diff --git a/SurvivalIsland/Library/metadata/47/479fe5da19b4fba4b9ea55d26873d375 b/SurvivalIsland/Library/metadata/47/479fe5da19b4fba4b9ea55d26873d375 index 97669dc..211c946 100644 Binary files a/SurvivalIsland/Library/metadata/47/479fe5da19b4fba4b9ea55d26873d375 and b/SurvivalIsland/Library/metadata/47/479fe5da19b4fba4b9ea55d26873d375 differ diff --git a/SurvivalIsland/Library/metadata/96/96b2117e72a038e41acc5be055c9c5f9 b/SurvivalIsland/Library/metadata/96/96b2117e72a038e41acc5be055c9c5f9 new file mode 100644 index 0000000..6c4aed2 Binary files /dev/null and b/SurvivalIsland/Library/metadata/96/96b2117e72a038e41acc5be055c9c5f9 differ diff --git a/SurvivalIsland/Library/metadata/ae/ae162c0523ab4468bb03ef160eb672e2 b/SurvivalIsland/Library/metadata/ae/ae162c0523ab4468bb03ef160eb672e2 index 9cffc86..c5bdb40 100644 Binary files a/SurvivalIsland/Library/metadata/ae/ae162c0523ab4468bb03ef160eb672e2 and b/SurvivalIsland/Library/metadata/ae/ae162c0523ab4468bb03ef160eb672e2 differ diff --git a/SurvivalIsland/Library/shadercompiler-1.log b/SurvivalIsland/Library/shadercompiler-1.log index c0dbfce..e00fefb 100644 --- a/SurvivalIsland/Library/shadercompiler-1.log +++ b/SurvivalIsland/Library/shadercompiler-1.log @@ -1,3 +1,3 @@ Base path: D:/Unity/Editor/Data -Pipe name: \\.\pipe\UnityShaderCompiler-1-7232 +Pipe name: \\.\pipe\UnityShaderCompiler-1-25372 Cmd: getPlatforms