diff --git a/Assets/Animations/lcp-man.controller b/Assets/Animations/lcp-man.controller index 6b3933e..3c57e3d 100644 Binary files a/Assets/Animations/lcp-man.controller and b/Assets/Animations/lcp-man.controller differ diff --git a/Assets/Animations/relaxing.anim b/Assets/Animations/relaxing.anim new file mode 100644 index 0000000..c9261c8 Binary files /dev/null and b/Assets/Animations/relaxing.anim differ diff --git a/Assets/Animations/relaxing.anim.meta b/Assets/Animations/relaxing.anim.meta new file mode 100644 index 0000000..ba0b99c --- /dev/null +++ b/Assets/Animations/relaxing.anim.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 1e2c1e8546c1cb247a40a3490cc3311f +timeCreated: 1501803538 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: -1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 4dab6de..2286a81 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 6b49e17..a72a79d 100644 --- a/Assets/Scripts/LcpManController.cs +++ b/Assets/Scripts/LcpManController.cs @@ -36,7 +36,8 @@ public enum Activities Phone, Attic, Closet, - Refrigerator + Refrigerator, + WashDishes } public enum CharacterStates { @@ -108,62 +109,7 @@ private void Update() private void HandleInput() { - if (Input.GetKeyDown("v")) - { - activityQueue.Push(Activities.TVChair); - } - - if (Input.GetKeyDown("s")) - { - activityQueue.Push(Activities.Sleep); - } - - if (Input.GetKeyDown("t")) - { - activityQueue.Push(Activities.Toilet); - } - - if (Input.GetKeyDown("b")) - { - activityQueue.Push(Activities.ReadBook); - } - if (Input.GetKeyDown("w")) - { - activityQueue.Push(Activities.Typewriter); - } - - if (Input.GetKeyDown("e")) - { - activityQueue.Push(Activities.Exercise); - } - - if (Input.GetKeyDown("f")) - { - activityQueue.Push(Activities.Cupboard); - } - - if (Input.GetKeyDown("l")) - { - activityQueue.Push(Activities.LeaveHouse); - } - - if (Input.GetKeyDown("z")) - { - activityQueue.Push(Activities.Attic); - } - if (Input.GetKeyDown("x")) - { - activityQueue.Push(Activities.Closet); - } - if (Input.GetKeyDown("r")) - { - activityQueue.Push(Activities.Sofa); - } - - - - - if (Input.GetKeyDown("a")) + if (isControlKeyPressed() && Input.GetKeyDown(KeyCode.A)) { GameObject.Find("Alarm_clock").GetComponent().Play(); if (currentActivity == Activities.Sleep) @@ -173,10 +119,11 @@ private void HandleInput() } } - if (Input.GetKeyDown("c")) + if (isControlKeyPressed() && Input.GetKeyDown(KeyCode.C)) { GameObject.Find("Phone_Base").GetComponent().state = PhoneController.States.ringing; activityQueue.Push(Activities.Phone); + FinishedActivity(currentActivity); } if (Input.GetKeyDown(KeyCode.Escape)) @@ -185,6 +132,11 @@ private void HandleInput() } } + private bool isControlKeyPressed() + { + return Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl); + } + void GoToActivity(Activities activity) { if (activity == Activities.TV) @@ -258,6 +210,9 @@ void GoToActivity(Activities activity) if (activity == Activities.Refrigerator) StartWalk(1, new Vector3(7.11f, 2.1f, 1.95f), Path.FacingDirection.backward, 3); + + if (activity == Activities.WashDishes) + StartWalk(1, new Vector3(5.22f, 2.1f, 1.63f), Path.FacingDirection.backward, 5); } void StartActivity(Activities activity) @@ -275,7 +230,7 @@ void StartActivity(Activities activity) PlaySound("speak1", true); } - if (currentActivity == Activities.BathroomSink) + if (currentActivity == Activities.BathroomSink || currentActivity == Activities.WashDishes) { PlaySound("sink", true); } @@ -301,7 +256,15 @@ void StartActivity(Activities activity) if (GameObject.Find("Book").GetComponent().enabled == true) characterModel.GetComponent().SetBool("isReading", true); else - characterModel.GetComponent().SetBool("isSitting", true); + { + int r = UnityEngine.Random.Range(1, 3); + + if (r == 1) + characterModel.GetComponent().SetBool("isSitting", true); + else + characterModel.GetComponent().SetBool("isRelaxing", true); + } + } if (currentActivity == Activities.Phone) @@ -325,7 +288,8 @@ void StartActivity(Activities activity) } if (currentActivity == Activities.Cupboard || currentActivity == Activities.ComputerDesk - || currentActivity == Activities.Typewriter || currentActivity == Activities.BathroomSink || currentActivity == Activities.Piano) + || currentActivity == Activities.Typewriter || currentActivity == Activities.BathroomSink + || currentActivity == Activities.Piano || currentActivity == Activities.WashDishes) { characterModel.GetComponent().SetBool("isDoing", true); } @@ -574,6 +538,7 @@ private void StopAnimations() characterModel.GetComponent().SetBool("isEating", false); characterModel.GetComponent().SetBool("isExercising", false); characterModel.GetComponent().SetBool("isReading", false); + characterModel.GetComponent().SetBool("isRelaxing", false); GameObject.Find("Shower").GetComponent().Stop(); GetComponent().Stop(); @@ -593,7 +558,7 @@ Activities GetNextActivity() return Activities.Sleep; } - int nextActivity = UnityEngine.Random.Range(1, 24); + int nextActivity = UnityEngine.Random.Range(1, 25); switch (nextActivity) { @@ -620,6 +585,7 @@ Activities GetNextActivity() case 21: return Activities.Phone; case 22: return Activities.Attic; case 23: return Activities.Closet; + case 24: return Activities.WashDishes; } return Activities.FrontDoor; diff --git a/Assets/Scripts/TypewriterController.cs b/Assets/Scripts/TypewriterController.cs index 7b1e343..af88179 100644 --- a/Assets/Scripts/TypewriterController.cs +++ b/Assets/Scripts/TypewriterController.cs @@ -1,4 +1,5 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; @@ -141,6 +142,9 @@ private IEnumerator PlayerInput(string v) TypewriterHead.transform.position = typewriterHeadDefaultPosition; lastPlayerEntered = TextLines[TextLines.Count - 2].text; + + PlayerInputHandler(lastPlayerEntered); + } else if(s == "\b") { @@ -181,4 +185,92 @@ private IEnumerator PlayerInput(string v) Hide(); } + + private void PlayerInputHandler(string input) + { + GameObject go = GameObject.Find("character"); + + input = input.ToLower(); + + if (input.Contains("please")) + { + if(input.Contains("read")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.ReadBook); + } + + if (input.Contains("type") || input.Contains("write") || input.Contains("letter")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.Typewriter); + } + + if (input.Contains("tv") || input.Contains("television")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.TVChair); + } + + if (input.Contains("sleep") || input.Contains("bed") || input.Contains("bedtime")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.Sleep); + } + + if (input.Contains("sofa") || input.Contains("relax") || input.Contains("rest")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.Sofa); + } + + if (input.Contains("play") || input.Contains("piano") || input.Contains("music")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.Piano); + } + + if (input.Contains("call") || input.Contains("telephone") || input.Contains("phone")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.Phone); + } + + if (input.Contains("eat") || input.Contains("food") || input.Contains("dinner") || input.Contains("lunch") || input.Contains("breakfast")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.Cupboard); + } + + if (input.Contains("fire") || input.Contains("fireplace") || input.Contains("chimney")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.BuildFire); + } + + if (input.Contains("dressed") || input.Contains("clothes") || input.Contains("shirt")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.Closet); + } + + if (input.Contains("shower") || input.Contains("bath")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.Shower); + } + + if (input.Contains("leave") || input.Contains("bye")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.LeaveHouse); + } + + if (input.Contains("exercise")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.Exercise); + } + + if (input.Contains("dishes")) + { + go.GetComponent().activityQueue.Push(LcpManController.Activities.WashDishes); + } + + } + + if (input == "help") + { + TextLines[0].text = "Try saying 'please' before a command!"; + TextLines[1].text = "CTRL-A = alarm clock, wake up"; + TextLines[2].text = "CTRL-C = call"; + } + } } diff --git a/ProjectSettings/GraphicsSettings.asset b/ProjectSettings/GraphicsSettings.asset index 4d83239..b7e87d0 100644 Binary files a/ProjectSettings/GraphicsSettings.asset and b/ProjectSettings/GraphicsSettings.asset differ