diff --git a/Assets/Materials/bathroomfloor.mat b/Assets/Materials/bathroomfloor.mat new file mode 100644 index 0000000..13c2141 Binary files /dev/null and b/Assets/Materials/bathroomfloor.mat differ diff --git a/Assets/Materials/bathroomfloor.mat.meta b/Assets/Materials/bathroomfloor.mat.meta new file mode 100644 index 0000000..06ecfaf --- /dev/null +++ b/Assets/Materials/bathroomfloor.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 888a87e544988ad4b8ff310f3846fed4 +timeCreated: 1501763028 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Materials/brick.mat b/Assets/Materials/brick.mat new file mode 100644 index 0000000..85e5b1f Binary files /dev/null and b/Assets/Materials/brick.mat differ diff --git a/Assets/Materials/brick.mat.meta b/Assets/Materials/brick.mat.meta new file mode 100644 index 0000000..b4fb425 --- /dev/null +++ b/Assets/Materials/brick.mat.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3ffe6b1defbbbd645a9320bd5096343c +timeCreated: 1501763475 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 2100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Models/lcp.blend b/Assets/Models/lcp.blend index 9840d2c..b271253 100644 Binary files a/Assets/Models/lcp.blend and b/Assets/Models/lcp.blend differ diff --git a/Assets/Models/lcp.blend1 b/Assets/Models/lcp.blend1 index 132c465..8a7b25b 100644 Binary files a/Assets/Models/lcp.blend1 and b/Assets/Models/lcp.blend1 differ diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 01cf453..4dab6de 100644 Binary files a/Assets/Scenes/Main.unity and b/Assets/Scenes/Main.unity differ diff --git a/Assets/Scripts/LcpManController.cs b/Assets/Scripts/LcpManController.cs index f63932d..6b49e17 100644 --- a/Assets/Scripts/LcpManController.cs +++ b/Assets/Scripts/LcpManController.cs @@ -287,7 +287,7 @@ void StartActivity(Activities activity) if (currentActivity == Activities.Typewriter) { - GameObject.Find("Panel").transform.position = panelVector3; + //GameObject.Find("Panel").transform.position = panelVector3; PlaySound("typewriter", true); } @@ -461,52 +461,16 @@ void DoingActivity(Activities activity) break; } - StartCoroutine(TypeLetter(t)); + GameObject.Find("GameObject").GetComponent().enabled = true; + GameObject.Find("GameObject").GetComponent().characterLetter = t; } - hasStarted = true; - } - - private IEnumerator TypeLetter(string v) - { - GameObject.Find("TypewriterHead").transform.position = typewriterHeadVector3; - - GameObject.Find("PageText (0)").GetComponent().text = ""; - GameObject.Find("PageText (1)").GetComponent().text = ""; - GameObject.Find("PageText (2)").GetComponent().text = ""; - GameObject.Find("PageText (3)").GetComponent().text = ""; - GameObject.Find("PageText (4)").GetComponent().text = ""; - - for (int x=0; x < v.Length; x++) + if (currentActivity == Activities.Typewriter && GameObject.Find("GameObject").GetComponent().enabled == false && hasStarted) { - string s = v.Substring(x, 1); - if (s == "|") - { - GameObject.Find("PageText (0)").GetComponent().text = GameObject.Find("PageText (1)").GetComponent().text; - GameObject.Find("PageText (1)").GetComponent().text = GameObject.Find("PageText (2)").GetComponent().text; - GameObject.Find("PageText (2)").GetComponent().text = GameObject.Find("PageText (3)").GetComponent().text; - GameObject.Find("PageText (3)").GetComponent().text = GameObject.Find("PageText (4)").GetComponent().text; - GameObject.Find("PageText (4)").GetComponent().text = ""; - - GameObject.Find("TypewriterHead").transform.position = typewriterHeadVector3; - } - else - { - Vector3 pos = GameObject.Find("TypewriterHead").transform.position; - pos.x -= 0.1f; - GameObject.Find("TypewriterHead").transform.position = pos; - GameObject.Find("PageText (4)").GetComponent().text += s; - } - - - yield return new WaitForSeconds(0.15f); + state = CharacterStates.finishedactivity; } - yield return new WaitForSeconds(3); - - GameObject.Find("TypewriterHead").transform.position = new Vector3(0, 0, 0); - state = CharacterStates.finishedactivity; - + hasStarted = true; } void FinishedActivity(Activities activity) @@ -589,7 +553,7 @@ void FinishedActivity(Activities activity) if (currentActivity == Activities.Typewriter) { - GameObject.Find("Panel").transform.position = new Vector3(0, 0, 0); + GameObject.Find("GameObject").GetComponent().enabled = false; } if (currentActivity == Activities.Phone) diff --git a/Assets/Scripts/TypewriterController.cs b/Assets/Scripts/TypewriterController.cs new file mode 100644 index 0000000..7b1e343 --- /dev/null +++ b/Assets/Scripts/TypewriterController.cs @@ -0,0 +1,184 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UI; + +public class TypewriterController : MonoBehaviour { + + public GameObject TypewriterHead; + public GameObject PaperPanel; + public List TextLines; + + public bool enabled = false; + public int hideDelay = 3; + public string characterLetter; + public string lastPlayerEntered; + + private Vector3 hideVector = new Vector3(0, 0, 0); + private Vector3 typewriterHeadDefaultPosition; + private Vector3 paperPanelDefaultPosition; + private bool isRunning = false; + + // Use this for initialization + void Start () { + + typewriterHeadDefaultPosition = TypewriterHead.transform.position; + paperPanelDefaultPosition = PaperPanel.transform.position; + + Hide(); + + } + + // Update is called once per frame + void Update () { + + string s = Input.inputString; + + if (s != "" && enabled == false && isRunning == false) + { + StartCoroutine(PlayerInput(s)); + } + + if (characterLetter != "" && enabled == true && isRunning == false) + { + Show(); + StartCoroutine(TypeLetter(characterLetter)); + } + + if (enabled == false) + { + Hide(); + } + + } + + private void Hide() + { + TypewriterHead.transform.position = hideVector; + PaperPanel.transform.position = hideVector; + + characterLetter = ""; + enabled = false; + isRunning = false; + } + + private void Show() + { + TypewriterHead.transform.position = typewriterHeadDefaultPosition; + PaperPanel.transform.position = paperPanelDefaultPosition; + + enabled = true; + isRunning = true; + } + + private IEnumerator TypeLetter(string v) + { + Show(); + + foreach(Text t in TextLines) + { + t.text = ""; + } + + for (int x = 0; x < v.Length; x++) + { + string s = v.Substring(x, 1); + if (s == "|") + { + for (int line=0; line <= TextLines.Count - 1; line++) + { + if (line != TextLines.Count-1) + TextLines[line].text = TextLines[line + 1].text; + else + TextLines[line].text = ""; + } + + TypewriterHead.transform.position = typewriterHeadDefaultPosition; + } + else + { + Vector3 pos = TypewriterHead.transform.position; + pos.x -= 0.1f; + TypewriterHead.transform.position = pos; + TextLines[TextLines.Count - 1].text += s; + } + + yield return new WaitForSeconds(0.15f); + } + + yield return new WaitForSeconds(3); + + Hide(); + + + } + + private IEnumerator PlayerInput(string v) + { + System.DateTime lastInputTime = System.DateTime.Now; + bool done = false; + Show(); + + foreach (Text t in TextLines) + { + t.text = ""; + } + + while (!done) + { + for (int x = 0; x < v.Length; x++) + { + string s = v.Substring(x, 1); + if (s == "\r") + { + for (int line = 0; line <= TextLines.Count - 1; line++) + { + if (line != TextLines.Count - 1) + TextLines[line].text = TextLines[line + 1].text; + else + TextLines[line].text = ""; + } + + TypewriterHead.transform.position = typewriterHeadDefaultPosition; + lastPlayerEntered = TextLines[TextLines.Count - 2].text; + } + else if(s == "\b") + { + string originalText = TextLines[TextLines.Count - 1].text; + if(originalText.Length > 0) + { + TextLines[TextLines.Count - 1].text = originalText.Substring(0, originalText.Length - 1); + + Vector3 pos = TypewriterHead.transform.position; + pos.x += 0.1f; + TypewriterHead.transform.position = pos; + } + } + else + { + Vector3 pos = TypewriterHead.transform.position; + pos.x -= 0.1f; + TypewriterHead.transform.position = pos; + TextLines[TextLines.Count - 1].text += s; + } + } + + yield return null; + + v = Input.inputString; + + if (v != "") + lastInputTime = System.DateTime.Now; + + System.TimeSpan timeDifference = System.DateTime.Now - lastInputTime; + + if (timeDifference.Seconds > 3) + done = true; + + } + + yield return new WaitForSeconds(3); + + Hide(); + } +} diff --git a/Assets/Scripts/TypewriterController.cs.meta b/Assets/Scripts/TypewriterController.cs.meta new file mode 100644 index 0000000..32d20a6 --- /dev/null +++ b/Assets/Scripts/TypewriterController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: b1008b13895934f47aed74534ec2d08e +timeCreated: 1501765588 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Textures/bathroomfloor.jpg b/Assets/Textures/bathroomfloor.jpg new file mode 100644 index 0000000..9bf3e33 Binary files /dev/null and b/Assets/Textures/bathroomfloor.jpg differ diff --git a/Assets/Textures/bathroomfloor.jpg.meta b/Assets/Textures/bathroomfloor.jpg.meta new file mode 100644 index 0000000..8425d47 --- /dev/null +++ b/Assets/Textures/bathroomfloor.jpg.meta @@ -0,0 +1,68 @@ +fileFormatVersion: 2 +guid: f232323205aa1654d82b79a1353bf7eb +timeCreated: 1501762939 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Textures/brick.jpg b/Assets/Textures/brick.jpg new file mode 100644 index 0000000..aa06477 Binary files /dev/null and b/Assets/Textures/brick.jpg differ diff --git a/Assets/Textures/brick.jpg.meta b/Assets/Textures/brick.jpg.meta new file mode 100644 index 0000000..8da9878 --- /dev/null +++ b/Assets/Textures/brick.jpg.meta @@ -0,0 +1,68 @@ +fileFormatVersion: 2 +guid: 8592fdddf91258245a0a9630cccfeaec +timeCreated: 1501763451 +licenseType: Free +TextureImporter: + fileIDToRecycleName: {} + serializedVersion: 4 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + filterMode: -1 + aniso: -1 + mipBias: -1 + wrapMode: -1 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spritePixelsToUnits: 100 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + platformSettings: + - buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + spritePackingTag: + userData: + assetBundleName: + assetBundleVariant: