diff --git a/Assets/Animations/exercise.anim b/Assets/Animations/exercise.anim new file mode 100644 index 0000000..19ee286 Binary files /dev/null and b/Assets/Animations/exercise.anim differ diff --git a/Assets/Animations/exercise.anim.meta b/Assets/Animations/exercise.anim.meta new file mode 100644 index 0000000..7287263 --- /dev/null +++ b/Assets/Animations/exercise.anim.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: dd3e5199b789f284abcedfff9d4e78ff +timeCreated: 1501138799 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Animations/idle.anim b/Assets/Animations/idle.anim index cb7309d..e7d71a7 100644 Binary files a/Assets/Animations/idle.anim and b/Assets/Animations/idle.anim differ diff --git a/Assets/Animations/lcp-man.controller b/Assets/Animations/lcp-man.controller index 2e28639..09cf4a6 100644 Binary files a/Assets/Animations/lcp-man.controller and b/Assets/Animations/lcp-man.controller differ diff --git a/Assets/Animations/walking.anim b/Assets/Animations/walking.anim index caff35f..e90fe2f 100644 Binary files a/Assets/Animations/walking.anim and b/Assets/Animations/walking.anim differ diff --git a/Assets/Models/Materials/phone.anim b/Assets/Models/Materials/phone.anim new file mode 100644 index 0000000..82b3cec Binary files /dev/null and b/Assets/Models/Materials/phone.anim differ diff --git a/Assets/Models/Materials/phone.anim.meta b/Assets/Models/Materials/phone.anim.meta new file mode 100644 index 0000000..f2d7e1d --- /dev/null +++ b/Assets/Models/Materials/phone.anim.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 05a2a18f9256ebc4cb38d7861ff759cc +timeCreated: 1501163897 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Models/lcp-man.blend b/Assets/Models/lcp-man.blend index ceebdc9..e241fd2 100644 Binary files a/Assets/Models/lcp-man.blend and b/Assets/Models/lcp-man.blend differ diff --git a/Assets/Models/lcp-man.blend1 b/Assets/Models/lcp-man.blend1 index 478012a..ceebdc9 100644 Binary files a/Assets/Models/lcp-man.blend1 and b/Assets/Models/lcp-man.blend1 differ diff --git a/Assets/Models/lcp.blend b/Assets/Models/lcp.blend index 4ff2afe..6db3996 100644 Binary files a/Assets/Models/lcp.blend and b/Assets/Models/lcp.blend differ diff --git a/Assets/Models/lcp.blend.meta b/Assets/Models/lcp.blend.meta index abeee8c..d6673e8 100644 --- a/Assets/Models/lcp.blend.meta +++ b/Assets/Models/lcp.blend.meta @@ -102,6 +102,9 @@ ModelImporter: 100188: Cylinder 100190: Food 100192: Plate + 100194: Cylinder_001 + 100196: Phone_Base + 100198: Phone_Handset 400000: Attic_door 400002: BackWall 400004: Bathroom_floor @@ -199,6 +202,9 @@ ModelImporter: 400188: Cylinder 400190: Food 400192: Plate + 400194: Cylinder_001 + 400196: Phone_Base + 400198: Phone_Handset 2300000: Attic_door 2300002: BackWall 2300004: Bathroom_floor @@ -295,6 +301,9 @@ ModelImporter: 2300186: Cylinder 2300188: Food 2300190: Plate + 2300192: Cylinder_001 + 2300194: Phone_Base + 2300196: Phone_Handset 3300000: Attic_door 3300002: BackWall 3300004: Bathroom_floor @@ -391,6 +400,9 @@ ModelImporter: 3300186: Cylinder 3300188: Food 3300190: Plate + 3300192: Cylinder_001 + 3300194: Phone_Base + 3300196: Phone_Handset 4300000: Refrigerator_handle_002 4300002: Refrigerator_handle_001 4300004: Bathroom_toilet_door_knob @@ -487,6 +499,9 @@ ModelImporter: 4300186: Cylinder 4300188: Food 4300190: Plate + 4300192: Phone_Base + 4300194: Cylinder_001 + 4300196: Phone_Handset 7400000: Default Take 9500000: //RootNode materials: diff --git a/Assets/Models/lcp.blend1 b/Assets/Models/lcp.blend1 index 47864d0..8914aa4 100644 Binary files a/Assets/Models/lcp.blend1 and b/Assets/Models/lcp.blend1 differ diff --git a/Assets/Resources/eating.wav b/Assets/Resources/eating.wav new file mode 100644 index 0000000..59381e4 Binary files /dev/null and b/Assets/Resources/eating.wav differ diff --git a/Assets/Resources/eating.wav.meta b/Assets/Resources/eating.wav.meta new file mode 100644 index 0000000..a75fe57 --- /dev/null +++ b/Assets/Resources/eating.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 393d91bd11ffc444c94329257a7ee1f4 +timeCreated: 1501140655 +licenseType: Free +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/exercise.wav b/Assets/Resources/exercise.wav new file mode 100644 index 0000000..1add0f8 Binary files /dev/null and b/Assets/Resources/exercise.wav differ diff --git a/Assets/Resources/exercise.wav.meta b/Assets/Resources/exercise.wav.meta new file mode 100644 index 0000000..daf6fb6 --- /dev/null +++ b/Assets/Resources/exercise.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: aa4f9291ff5604144b8c509576e78cbd +timeCreated: 1501140232 +licenseType: Free +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/phone.wav b/Assets/Resources/phone.wav new file mode 100644 index 0000000..eac63c0 Binary files /dev/null and b/Assets/Resources/phone.wav differ diff --git a/Assets/Resources/phone.wav.meta b/Assets/Resources/phone.wav.meta new file mode 100644 index 0000000..3a5c044 --- /dev/null +++ b/Assets/Resources/phone.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 1057fc4f0329406429de9cc90e6ec1c6 +timeCreated: 1501165413 +licenseType: Free +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/walk.wav b/Assets/Resources/walk.wav new file mode 100644 index 0000000..fe7e277 Binary files /dev/null and b/Assets/Resources/walk.wav differ diff --git a/Assets/Resources/walk.wav.meta b/Assets/Resources/walk.wav.meta new file mode 100644 index 0000000..5584e3f --- /dev/null +++ b/Assets/Resources/walk.wav.meta @@ -0,0 +1,22 @@ +fileFormatVersion: 2 +guid: 315b4eb0366e7ee49b18e0bce785aba8 +timeCreated: 1501141294 +licenseType: Free +AudioImporter: + serializedVersion: 6 + defaultSettings: + loadType: 0 + sampleRateSetting: 0 + sampleRateOverride: 44100 + compressionFormat: 1 + quality: 1 + conversionMode: 0 + platformSettingOverrides: {} + forceToMono: 0 + normalize: 1 + preloadAudioData: 1 + loadInBackground: 0 + 3D: 1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 0babace..634ba22 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 be37343..a783281 100644 --- a/Assets/Scripts/LcpManController.cs +++ b/Assets/Scripts/LcpManController.cs @@ -30,7 +30,9 @@ public enum Activities BuildFire, Cupboard, Toilet, - ReadBook + ReadBook, + Exercise, + Phone } public enum CharacterStates { @@ -67,6 +69,33 @@ void Start () { private void Update() + { + HandleInput(); + + if (state == CharacterStates.idle) + { + currentActivity = GetNextActivity(); + GoToActivity(currentActivity); + } + + if (state == CharacterStates.startactivity) + { + StartActivity(currentActivity); + } + + if (state == CharacterStates.doingactivity) + { + DoingActivity(currentActivity); + } + + if (state == CharacterStates.finishedactivity) + { + FinishedActivity(currentActivity); + } + + } + + private void HandleInput() { if (Input.GetKeyDown("v")) { @@ -92,38 +121,37 @@ private void Update() activityQueue.Push(Activities.Typewriter); } + if (Input.GetKeyDown("e")) + { + activityQueue.Push(Activities.Exercise); + } + + if (Input.GetKeyDown("f")) + { + activityQueue.Push(Activities.Cupboard); + } + if (Input.GetKeyDown("a")) { GameObject.Find("Alarm_clock").GetComponent().Play(); - if(currentActivity == Activities.Sleep) + if (currentActivity == Activities.Sleep) { activityQueue.Push(Activities.Toilet); FinishedActivity(currentActivity); } } - if (state == CharacterStates.idle) - { - currentActivity = GetNextActivity(); - GoToActivity(currentActivity); - } - - if (state == CharacterStates.startactivity) + if (Input.GetKeyDown("c")) { - StartActivity(currentActivity); + GameObject.Find("Phone_Base").GetComponent().state = PhoneController.States.ringing; + activityQueue.Push(Activities.Phone); } - if (state == CharacterStates.doingactivity) - { - DoingActivity(currentActivity); - } - - if (state == CharacterStates.finishedactivity) + if (Input.GetKeyDown(KeyCode.Escape)) { - FinishedActivity(currentActivity); + Application.Quit(); } - } void GoToActivity(Activities activity) @@ -141,7 +169,7 @@ void GoToActivity(Activities activity) StartWalk(2, new Vector3(-4.78f, 5.41f, 2.62f), Movement.FacingDirection.forward, 3); if (activity == Activities.KitchenTable) - StartWalk(1, new Vector3(3.66f, 2.27f, 1.75f), Movement.FacingDirection.forward, 5); + StartWalk(1, new Vector3(3.66f, 2.27f, 1.75f), Movement.FacingDirection.forward, 10); if (activity == Activities.ComputerDesk) StartWalk(2, new Vector3(-6.04f, 5.32f, 1.64f), Movement.FacingDirection.backward, 20); @@ -184,12 +212,21 @@ void GoToActivity(Activities activity) if (activity == Activities.ReadBook) StartWalk(2, new Vector3(-4.249f, 5.392f, 1.43f), Movement.FacingDirection.backward, 1); + + if (activity == Activities.Exercise) + StartWalk(2, new Vector3(5.77f, 5.392f, 2.17f), Movement.FacingDirection.forward, 10); + + if (activity == Activities.Phone) + StartWalk(1, new Vector3(-2.62f, 1.94f, 0.883f), Movement.FacingDirection.forward, 10); + } void StartActivity(Activities activity) { + StopAltSound(); + if (currentActivity == Activities.Shower) { GameObject.Find("Shower").GetComponent().Play(); @@ -227,11 +264,26 @@ void StartActivity(Activities activity) characterModel.GetComponent().SetBool("isSitting", true); } + if (currentActivity == Activities.Phone) + { + GameObject.Find("Phone_Handset").GetComponent().enabled = false; + GameObject.Find("Phone_Base").GetComponent().state = PhoneController.States.normal; + PlaySound("speak1", true); + GameObject.Find("Phone").GetComponent().enabled = true; + characterModel.GetComponent().SetBool("isUsingPhone", true); + } + if (currentActivity == Activities.BuildFire || currentActivity == Activities.TV) { characterModel.GetComponent().SetBool("isBending", true); } + if (currentActivity == Activities.Exercise) + { + PlaySound("exercise", true); + characterModel.GetComponent().SetBool("isExercising", true); + } + if (currentActivity == Activities.Cupboard || currentActivity == Activities.ComputerDesk || currentActivity == Activities.Typewriter || currentActivity == Activities.BathroomSink || currentActivity == Activities.Piano) { @@ -240,6 +292,7 @@ void StartActivity(Activities activity) if (currentActivity == Activities.KitchenTable) { + PlaySound("eating", true); characterModel.GetComponent().SetBool("isEating", true); } @@ -331,6 +384,7 @@ void FinishedActivity(Activities activity) characterModel.GetComponent().SetBool("isBending", false); characterModel.GetComponent().SetBool("isDoing", false); characterModel.GetComponent().SetBool("isEating", false); + characterModel.GetComponent().SetBool("isExercising", false); if (activity == Activities.Sleep) { @@ -390,6 +444,13 @@ void FinishedActivity(Activities activity) { GameObject.Find("Panel").transform.position = new Vector3(0, 0, 0); } + + if (currentActivity == Activities.Phone) + { + GameObject.Find("Phone_Handset").GetComponent().enabled = true; + GameObject.Find("Phone").GetComponent().enabled = false; + characterModel.GetComponent().SetBool("isUsingPhone", false); + } } Activities GetNextActivity() @@ -406,7 +467,7 @@ Activities GetNextActivity() return Activities.Sleep; } - int nextActivity = UnityEngine.Random.Range(1, 20); + int nextActivity = UnityEngine.Random.Range(1, 22); switch (nextActivity) { @@ -429,6 +490,8 @@ Activities GetNextActivity() case 17: return Activities.Cupboard; case 18: return Activities.Toilet; case 19: return Activities.ReadBook; + case 20: return Activities.Exercise; + case 21: return Activities.Phone; } return Activities.FrontDoor; @@ -436,6 +499,8 @@ Activities GetNextActivity() void StartWalk(int floor, Vector3 location, Movement.FacingDirection facing, int timeToStay) { + StartAltSound("walk", true); + List waypoints = MoveBetweenFloors(currentFloor, floor); waypoints.Add(location); path = new Movement(waypoints, facing, floor, timeToStay); @@ -560,6 +625,26 @@ void PlaySound(string sound, bool loop) } + void StopSound() + { + GetComponent().Stop(); + } + + void StartAltSound(string sound, bool loop) + { + AudioSource go = GameObject.Find("GameObject").GetComponent(); + AudioClip clip = Resources.Load(sound); + go.loop = loop; + go.clip = clip; + go.Play(); + } + + void StopAltSound() + { + AudioSource go = GameObject.Find("GameObject").GetComponent(); + go.Stop(); + } + IEnumerator BlinkCoroutine() { while (true) diff --git a/Assets/Scripts/PhoneController.cs b/Assets/Scripts/PhoneController.cs new file mode 100644 index 0000000..612fbfc --- /dev/null +++ b/Assets/Scripts/PhoneController.cs @@ -0,0 +1,36 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class PhoneController : MonoBehaviour { + + public States state; + + public enum States + { + normal, + ringing + } + + // Use this for initialization + void Start () { + + state = States.normal; + + } + + // Update is called once per frame + void Update () { + + if(state == States.ringing && !GetComponent().isPlaying) + { + GetComponent().Play(); + } + if (state == States.normal && GetComponent().isPlaying) + { + GetComponent().Stop(); + } + + + } +} diff --git a/Assets/Scripts/PhoneController.cs.meta b/Assets/Scripts/PhoneController.cs.meta new file mode 100644 index 0000000..05971c1 --- /dev/null +++ b/Assets/Scripts/PhoneController.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 02708ced3ae153744a64a648537d87a2 +timeCreated: 1501165641 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: