@@ -36,7 +36,8 @@ public enum Activities
3636 Phone ,
3737 Attic ,
3838 Closet ,
39- Refrigerator
39+ Refrigerator ,
40+ WashDishes
4041 }
4142 public enum CharacterStates
4243 {
@@ -108,62 +109,7 @@ private void Update()
108109
109110 private void HandleInput ( )
110111 {
111- if ( Input . GetKeyDown ( "v" ) )
112- {
113- activityQueue . Push ( Activities . TVChair ) ;
114- }
115-
116- if ( Input . GetKeyDown ( "s" ) )
117- {
118- activityQueue . Push ( Activities . Sleep ) ;
119- }
120-
121- if ( Input . GetKeyDown ( "t" ) )
122- {
123- activityQueue . Push ( Activities . Toilet ) ;
124- }
125-
126- if ( Input . GetKeyDown ( "b" ) )
127- {
128- activityQueue . Push ( Activities . ReadBook ) ;
129- }
130- if ( Input . GetKeyDown ( "w" ) )
131- {
132- activityQueue . Push ( Activities . Typewriter ) ;
133- }
134-
135- if ( Input . GetKeyDown ( "e" ) )
136- {
137- activityQueue . Push ( Activities . Exercise ) ;
138- }
139-
140- if ( Input . GetKeyDown ( "f" ) )
141- {
142- activityQueue . Push ( Activities . Cupboard ) ;
143- }
144-
145- if ( Input . GetKeyDown ( "l" ) )
146- {
147- activityQueue . Push ( Activities . LeaveHouse ) ;
148- }
149-
150- if ( Input . GetKeyDown ( "z" ) )
151- {
152- activityQueue . Push ( Activities . Attic ) ;
153- }
154- if ( Input . GetKeyDown ( "x" ) )
155- {
156- activityQueue . Push ( Activities . Closet ) ;
157- }
158- if ( Input . GetKeyDown ( "r" ) )
159- {
160- activityQueue . Push ( Activities . Sofa ) ;
161- }
162-
163-
164-
165-
166- if ( Input . GetKeyDown ( "a" ) )
112+ if ( isControlKeyPressed ( ) && Input . GetKeyDown ( KeyCode . A ) )
167113 {
168114 GameObject . Find ( "Alarm_clock" ) . GetComponent < AudioSource > ( ) . Play ( ) ;
169115 if ( currentActivity == Activities . Sleep )
@@ -173,10 +119,11 @@ private void HandleInput()
173119 }
174120 }
175121
176- if ( Input . GetKeyDown ( "c" ) )
122+ if ( isControlKeyPressed ( ) && Input . GetKeyDown ( KeyCode . C ) )
177123 {
178124 GameObject . Find ( "Phone_Base" ) . GetComponent < PhoneController > ( ) . state = PhoneController . States . ringing ;
179125 activityQueue . Push ( Activities . Phone ) ;
126+ FinishedActivity ( currentActivity ) ;
180127 }
181128
182129 if ( Input . GetKeyDown ( KeyCode . Escape ) )
@@ -185,6 +132,11 @@ private void HandleInput()
185132 }
186133 }
187134
135+ private bool isControlKeyPressed ( )
136+ {
137+ return Input . GetKey ( KeyCode . LeftControl ) || Input . GetKey ( KeyCode . RightControl ) ;
138+ }
139+
188140 void GoToActivity ( Activities activity )
189141 {
190142 if ( activity == Activities . TV )
@@ -258,6 +210,9 @@ void GoToActivity(Activities activity)
258210
259211 if ( activity == Activities . Refrigerator )
260212 StartWalk ( 1 , new Vector3 ( 7.11f , 2.1f , 1.95f ) , Path . FacingDirection . backward , 3 ) ;
213+
214+ if ( activity == Activities . WashDishes )
215+ StartWalk ( 1 , new Vector3 ( 5.22f , 2.1f , 1.63f ) , Path . FacingDirection . backward , 5 ) ;
261216 }
262217
263218 void StartActivity ( Activities activity )
@@ -275,7 +230,7 @@ void StartActivity(Activities activity)
275230 PlaySound ( "speak1" , true ) ;
276231 }
277232
278- if ( currentActivity == Activities . BathroomSink )
233+ if ( currentActivity == Activities . BathroomSink || currentActivity == Activities . WashDishes )
279234 {
280235 PlaySound ( "sink" , true ) ;
281236 }
@@ -301,7 +256,15 @@ void StartActivity(Activities activity)
301256 if ( GameObject . Find ( "Book" ) . GetComponent < MeshRenderer > ( ) . enabled == true )
302257 characterModel . GetComponent < Animator > ( ) . SetBool ( "isReading" , true ) ;
303258 else
304- characterModel . GetComponent < Animator > ( ) . SetBool ( "isSitting" , true ) ;
259+ {
260+ int r = UnityEngine . Random . Range ( 1 , 3 ) ;
261+
262+ if ( r == 1 )
263+ characterModel . GetComponent < Animator > ( ) . SetBool ( "isSitting" , true ) ;
264+ else
265+ characterModel . GetComponent < Animator > ( ) . SetBool ( "isRelaxing" , true ) ;
266+ }
267+
305268 }
306269
307270 if ( currentActivity == Activities . Phone )
@@ -325,7 +288,8 @@ void StartActivity(Activities activity)
325288 }
326289
327290 if ( currentActivity == Activities . Cupboard || currentActivity == Activities . ComputerDesk
328- || currentActivity == Activities . Typewriter || currentActivity == Activities . BathroomSink || currentActivity == Activities . Piano )
291+ || currentActivity == Activities . Typewriter || currentActivity == Activities . BathroomSink
292+ || currentActivity == Activities . Piano || currentActivity == Activities . WashDishes )
329293 {
330294 characterModel . GetComponent < Animator > ( ) . SetBool ( "isDoing" , true ) ;
331295 }
@@ -574,6 +538,7 @@ private void StopAnimations()
574538 characterModel . GetComponent < Animator > ( ) . SetBool ( "isEating" , false ) ;
575539 characterModel . GetComponent < Animator > ( ) . SetBool ( "isExercising" , false ) ;
576540 characterModel . GetComponent < Animator > ( ) . SetBool ( "isReading" , false ) ;
541+ characterModel . GetComponent < Animator > ( ) . SetBool ( "isRelaxing" , false ) ;
577542
578543 GameObject . Find ( "Shower" ) . GetComponent < ParticleSystem > ( ) . Stop ( ) ;
579544 GetComponent < AudioSource > ( ) . Stop ( ) ;
@@ -593,7 +558,7 @@ Activities GetNextActivity()
593558 return Activities . Sleep ;
594559 }
595560
596- int nextActivity = UnityEngine . Random . Range ( 1 , 24 ) ;
561+ int nextActivity = UnityEngine . Random . Range ( 1 , 25 ) ;
597562
598563 switch ( nextActivity )
599564 {
@@ -620,6 +585,7 @@ Activities GetNextActivity()
620585 case 21 : return Activities . Phone ;
621586 case 22 : return Activities . Attic ;
622587 case 23 : return Activities . Closet ;
588+ case 24 : return Activities . WashDishes ;
623589 }
624590
625591 return Activities . FrontDoor ;
0 commit comments