diff --git a/Assets/Animations/lcp-man.controller b/Assets/Animations/lcp-man.controller index 09cf4a6..6b3933e 100644 Binary files a/Assets/Animations/lcp-man.controller and b/Assets/Animations/lcp-man.controller differ diff --git a/Assets/Animations/reading.anim b/Assets/Animations/reading.anim new file mode 100644 index 0000000..30e6ef7 Binary files /dev/null and b/Assets/Animations/reading.anim differ diff --git a/Assets/Animations/reading.anim.meta b/Assets/Animations/reading.anim.meta new file mode 100644 index 0000000..2ff2288 --- /dev/null +++ b/Assets/Animations/reading.anim.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: c64f940c5e413984db7f4d5f692487ae +timeCreated: 1501611615 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: -1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Animations/walking-carry.anim b/Assets/Animations/walking-carry.anim new file mode 100644 index 0000000..0186cdb Binary files /dev/null and b/Assets/Animations/walking-carry.anim differ diff --git a/Assets/Animations/walking-carry.anim.meta b/Assets/Animations/walking-carry.anim.meta new file mode 100644 index 0000000..9f0dfee --- /dev/null +++ b/Assets/Animations/walking-carry.anim.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 8bf0d1ab9c60a794f922896580c4c162 +timeCreated: 1501610441 +licenseType: Free +NativeFormatImporter: + mainObjectFileID: -1 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Models/lcp.blend b/Assets/Models/lcp.blend index f418e66..9840d2c 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 d17c45d..9bde8f2 100644 --- a/Assets/Models/lcp.blend.meta +++ b/Assets/Models/lcp.blend.meta @@ -109,6 +109,8 @@ ModelImporter: 100202: Livingroom_Chair 100204: Bed_Sheet 100206: Cube + 100208: Refrigerator_Door + 100210: Refrigerator_Freezer_Door 400000: Attic_door 400002: BackWall 400004: Bathroom_floor @@ -213,6 +215,8 @@ ModelImporter: 400202: Livingroom_Chair 400204: Bed_Sheet 400206: Cube + 400208: Refrigerator_Door + 400210: Refrigerator_Freezer_Door 2300000: Attic_door 2300002: BackWall 2300004: Bathroom_floor @@ -316,6 +320,8 @@ ModelImporter: 2300200: Livingroom_Chair 2300202: Bed_Sheet 2300204: Cube + 2300206: Refrigerator_Door + 2300208: Refrigerator_Freezer_Door 3300000: Attic_door 3300002: BackWall 3300004: Bathroom_floor @@ -419,6 +425,8 @@ ModelImporter: 3300200: Livingroom_Chair 3300202: Bed_Sheet 3300204: Cube + 3300206: Refrigerator_Door + 3300208: Refrigerator_Freezer_Door 4300000: Refrigerator_handle_002 4300002: Refrigerator_handle_001 4300004: Bathroom_toilet_door_knob @@ -522,6 +530,8 @@ ModelImporter: 4300200: Livingroom_Chair 4300202: Bed_Sheet 4300204: Cube + 4300206: Refrigerator_Door + 4300208: Refrigerator_Freezer_Door 7400000: Default Take 9500000: //RootNode materials: diff --git a/Assets/Models/lcp.blend1 b/Assets/Models/lcp.blend1 index 9968d34..132c465 100644 Binary files a/Assets/Models/lcp.blend1 and b/Assets/Models/lcp.blend1 differ diff --git a/Assets/Models/refrigerator_door.blend b/Assets/Models/refrigerator_door.blend new file mode 100644 index 0000000..3f4dc7e Binary files /dev/null and b/Assets/Models/refrigerator_door.blend differ diff --git a/Assets/Models/refrigerator_door.blend.meta b/Assets/Models/refrigerator_door.blend.meta new file mode 100644 index 0000000..ff38b02 --- /dev/null +++ b/Assets/Models/refrigerator_door.blend.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 26eb5481948943044b6ad5648d6a88e1 +timeCreated: 1501608093 +licenseType: Free +ModelImporter: + serializedVersion: 19 + fileIDToRecycleName: + 100000: //RootNode + 400000: //RootNode + 2300000: //RootNode + 3300000: //RootNode + 4300000: Refrigerator_Door + 7400000: Default Take + 9500000: //RootNode + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + 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: 2 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Models/refrigerator_door.blend1 b/Assets/Models/refrigerator_door.blend1 new file mode 100644 index 0000000..428f696 Binary files /dev/null and b/Assets/Models/refrigerator_door.blend1 differ diff --git a/Assets/Models/refrigerator_door.blend1.meta b/Assets/Models/refrigerator_door.blend1.meta new file mode 100644 index 0000000..cd18d39 --- /dev/null +++ b/Assets/Models/refrigerator_door.blend1.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5736451ca3623b34d857625db12c7d43 +timeCreated: 1501608092 +licenseType: Free +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Models/type.blend b/Assets/Models/type.blend new file mode 100644 index 0000000..191a110 Binary files /dev/null and b/Assets/Models/type.blend differ diff --git a/Assets/Models/type.blend.meta b/Assets/Models/type.blend.meta new file mode 100644 index 0000000..10cdb17 --- /dev/null +++ b/Assets/Models/type.blend.meta @@ -0,0 +1,84 @@ +fileFormatVersion: 2 +guid: 0a672317c5414c74cbf320a8937f613b +timeCreated: 1501727857 +licenseType: Free +ModelImporter: + serializedVersion: 19 + fileIDToRecycleName: + 100000: //RootNode + 400000: //RootNode + 2300000: //RootNode + 3300000: //RootNode + 4300000: Cube + 7400000: Default Take + 9500000: //RootNode + materials: + importMaterials: 1 + materialName: 0 + materialSearch: 1 + animations: + legacyGenerateAnimations: 4 + bakeSimulation: 0 + resampleCurves: 1 + optimizeGameObjects: 0 + motionNodeName: + rigImportErrors: + rigImportWarnings: + 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: 2 + humanoidOversampling: 1 + additionalBone: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Main.unity b/Assets/Scenes/Main.unity index 59fc845..01cf453 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 fc619b9..f63932d 100644 --- a/Assets/Scripts/LcpManController.cs +++ b/Assets/Scripts/LcpManController.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +using UnityEngine.UI; public class LcpManController : MonoBehaviour { @@ -34,7 +35,8 @@ public enum Activities Exercise, Phone, Attic, - Closet + Closet, + Refrigerator } public enum CharacterStates { @@ -52,10 +54,12 @@ public enum CharacterStates public CharacterStates state; private Path path; private string lastSound = ""; + private bool hasStarted = false; private Vector3 tempVec1; private Vector3 tempVec2; private Vector3 panelVector3; + private Vector3 typewriterHeadVector3; // Use this for initialization void Start () { @@ -66,7 +70,12 @@ void Start () { panelVector3 = GameObject.Find("Panel").transform.position; GameObject.Find("Panel").transform.position = new Vector3(0, 0, 0); + typewriterHeadVector3 = GameObject.Find("TypewriterHead").transform.position; + GameObject.Find("TypewriterHead").transform.position = new Vector3(0, 0, 0); + StartCoroutine(BlinkCoroutine()); + + activityQueue.Push(Activities.FrontDoor); } @@ -146,6 +155,11 @@ private void HandleInput() { activityQueue.Push(Activities.Closet); } + if (Input.GetKeyDown("r")) + { + activityQueue.Push(Activities.Sofa); + } + @@ -186,7 +200,7 @@ void GoToActivity(Activities activity) StartWalk(2, new Vector3(-4.78f, 5.41f, 2.62f), Path.FacingDirection.forward, 3); if (activity == Activities.KitchenTable) - StartWalk(1, new Vector3(3.66f, 2.27f, 1.75f), Path.FacingDirection.forward, 10); + StartWalk(1, new Vector3(3.66f, 2.27f, 1.75f), Path.FacingDirection.forward, 10, true); if (activity == Activities.ComputerDesk) StartWalk(2, new Vector3(-6.04f, 5.32f, 1.64f), Path.FacingDirection.backward, 20); @@ -201,7 +215,7 @@ void GoToActivity(Activities activity) StartWalk(1, new Vector3(-7.24f, 2.12f, 2.62f), Path.FacingDirection.forward, 2); if (activity == Activities.Typewriter) - StartWalk(3, new Vector3(-2.327f, 8.62f, 1.137f), Path.FacingDirection.forward, 10); + StartWalk(3, new Vector3(-2.327f, 8.62f, 1.137f), Path.FacingDirection.forward, 0); if (activity == Activities.Kitchen) StartWalk(1, new Vector3(5.56f, 2.17f, 2.62f), Path.FacingDirection.forward, 5); @@ -210,7 +224,7 @@ void GoToActivity(Activities activity) StartWalk(3, new Vector3(1.99f, 8.54f, 1.767f), Path.FacingDirection.backward, 10); if (activity == Activities.Sofa) - StartWalk(1, new Vector3(-2.997f, 1.993f, 1.34f), Path.FacingDirection.forward, 5); + StartWalk(1, new Vector3(-2.997f, 1.993f, 1.34f), Path.FacingDirection.forward, 8); if (activity == Activities.Sleep) StartWalk(2, new Vector3(7.22f, 5.43f, 2.62f), Path.FacingDirection.up, 3600); @@ -242,6 +256,8 @@ void GoToActivity(Activities activity) if (activity == Activities.Closet) StartWalk(2, new Vector3(5.19f, 5.43f, 1.15f), Path.FacingDirection.backward, 8); + if (activity == Activities.Refrigerator) + StartWalk(1, new Vector3(7.11f, 2.1f, 1.95f), Path.FacingDirection.backward, 3); } void StartActivity(Activities activity) @@ -282,7 +298,10 @@ void StartActivity(Activities activity) if (currentActivity == Activities.Sofa) { - characterModel.GetComponent().SetBool("isSitting", true); + if (GameObject.Find("Book").GetComponent().enabled == true) + characterModel.GetComponent().SetBool("isReading", true); + else + characterModel.GetComponent().SetBool("isSitting", true); } if (currentActivity == Activities.Phone) @@ -341,6 +360,7 @@ void StartActivity(Activities activity) if (currentActivity == Activities.Attic) { GameObject.Find("Attic Door").GetComponent().state = DoorController.DoorStates.open; + transform.position = new Vector3(-7.24f, 2.12f, -1.4f); } if (currentActivity == Activities.Closet) @@ -348,6 +368,11 @@ void StartActivity(Activities activity) GameObject.Find("Closet Door").GetComponent().state = DoorController.DoorStates.open; } + if (currentActivity == Activities.Refrigerator) + { + GameObject.Find("Refrigerator Door").GetComponent().state = DoorController.DoorStates.open; + } + if (currentActivity == Activities.ReadBook) { GameObject.Find("Book").GetComponent().enabled = true; @@ -370,8 +395,12 @@ void DoingActivity(Activities activity) { System.TimeSpan timeDifference = System.DateTime.Now - arrivalTime; - if (timeDifference.Seconds > path.stayMaxTime) - state = CharacterStates.finishedactivity; + if (path.stayMaxTime > 0) + { + if (timeDifference.Seconds > path.stayMaxTime) + state = CharacterStates.finishedactivity; + } + if (currentActivity == Activities.LeaveHouse) { @@ -412,6 +441,72 @@ void DoingActivity(Activities activity) GameObject.Find("Attic Door").GetComponent().state = DoorController.DoorStates.closed; } } + + if (currentActivity == Activities.Typewriter && !hasStarted) + { + int r = UnityEngine.Random.Range(1, 5); + string t = ""; + + switch(r) + { + case 1: t = "Dear Friend, |I wanted to tell you how much I love my new home. |It's a really cool place to live. |Thanks!|Bob|"; + break; + case 2: t = "Dear Friend, |Living alone is kind of dull. But at least I have you to keep me entertained. And honestly... its 2017. Why do I still|use a typewriter?|Bob|"; + break; + case 3: t = "Dear Friend, |I realize Im a remake of an older computer game. But being in 3D, |I feel a little bit fatter than I used to. Do you think| Ive put on weight since the 80s?|Bob|"; + break; + case 4: t = "Dear Friend, |I used to have a a dog. I miss him. What ever happened to him? Maybe|you will program me a dog someday? Or a girlfriend?|Bob|"; + break; + case 5: t = "Dear Friend, |You may think I have endless supplies of paper to type on, |but I really dont. Nor do I have endless food and water.|Lets get on it, mmkay?|Bob|"; + break; + } + + StartCoroutine(TypeLetter(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++) + { + 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); + } + + yield return new WaitForSeconds(3); + + GameObject.Find("TypewriterHead").transform.position = new Vector3(0, 0, 0); + state = CharacterStates.finishedactivity; + } void FinishedActivity(Activities activity) @@ -444,7 +539,7 @@ void FinishedActivity(Activities activity) if (activity == Activities.Cupboard) { - activityQueue.Push(Activities.Stove); + activityQueue.Push(Activities.Refrigerator); } if (activity == Activities.Stove) @@ -476,6 +571,12 @@ void FinishedActivity(Activities activity) GameObject.Find("Closet Door").GetComponent().state = DoorController.DoorStates.closed; } + if (activity == Activities.Refrigerator) + { + GameObject.Find("Refrigerator Door").GetComponent().state = DoorController.DoorStates.closed; + activityQueue.Push(Activities.Stove); + } + if (activity == Activities.BuildFire) { GameObject.Find("Fire").GetComponent().Play(); @@ -497,6 +598,8 @@ void FinishedActivity(Activities activity) GameObject.Find("Phone").GetComponent().enabled = false; characterModel.GetComponent().SetBool("isUsingPhone", false); } + + hasStarted = false; } private void StopAnimations() @@ -506,6 +609,7 @@ private void StopAnimations() characterModel.GetComponent().SetBool("isDoing", false); characterModel.GetComponent().SetBool("isEating", false); characterModel.GetComponent().SetBool("isExercising", false); + characterModel.GetComponent().SetBool("isReading", false); GameObject.Find("Shower").GetComponent().Stop(); GetComponent().Stop(); @@ -557,12 +661,12 @@ Activities GetNextActivity() return Activities.FrontDoor; } - void StartWalk(int floor, Vector3 location, Path.FacingDirection facing, int timeToStay) + void StartWalk(int floor, Vector3 location, Path.FacingDirection facing, int timeToStay, bool isCarrying = false) { List waypoints = GetPath(currentFloor, floor); waypoints.Add(location); path = new Path(waypoints, facing, floor, timeToStay); - StartCoroutine(WalkCoroutine(path)); + StartCoroutine(WalkCoroutine(path, isCarrying)); } List GetPath(int startFloor, int endFloor) @@ -630,11 +734,15 @@ List GetPath(int startFloor, int endFloor) return waypoints; } - IEnumerator WalkCoroutine(Path path) + IEnumerator WalkCoroutine(Path path, bool isCarrying) { StartAltSound("walk", true); state = CharacterStates.walking; - characterModel.GetComponent().SetBool("isWalking", true); + + if (isCarrying) + characterModel.GetComponent().SetBool("isCarrying", true); + else + characterModel.GetComponent().SetBool("isWalking", true); foreach (Vector3 position in path.waypoints) { @@ -657,6 +765,7 @@ IEnumerator WalkCoroutine(Path path) } + characterModel.GetComponent().SetBool("isCarrying", false); characterModel.GetComponent().SetBool("isWalking", false); if (path.finalFacing == Path.FacingDirection.forward)