Permalink
Browse files

Added SceneFive class and resources for scene five

Mouth movements may not be correct yet.
The scene currently loops due to a commented out line. When adding SceneSix,
SceneFive should be changed to automatically end.
  • Loading branch information...
absurdhero committed Feb 28, 2012
1 parent c59e8d0 commit 2000438fe4ca86908fd8cfbacfd8561a439b4866
Showing with 143 additions and 1 deletion.
  1. BIN Assets/Images/SceneFive/PurpleQuad.png
  2. BIN Assets/Images/SceneFive/head_closeup1-fixed.png
  3. BIN Assets/Images/SceneFive/head_closeup2-fixed.png
  4. BIN Assets/Images/SceneFive/head_closeup2.png
  5. BIN Assets/Images/SceneFive/head_closeup_bg.png
  6. BIN Assets/Images/SceneFive/kiss-fixed.png
  7. BIN Assets/Images/SceneFive/kiss.png
  8. BIN Assets/Images/SceneFive/kiss_blue-fixed.png
  9. BIN Assets/Images/SceneFive/kiss_blue.png
  10. BIN Assets/Images/SceneFive/mouth1-1-start-fixed.png
  11. BIN Assets/Images/SceneFive/mouth1-1-start.png
  12. BIN Assets/Images/SceneFive/mouth1-2-start-fixed.png
  13. BIN Assets/Images/SceneFive/mouth1-2-start.png
  14. BIN Assets/Images/SceneFive/mouth10-1-goo-fixed.png
  15. BIN Assets/Images/SceneFive/mouth10-1-goo.png
  16. BIN Assets/Images/SceneFive/mouth10-2-goo-fixed.png
  17. BIN Assets/Images/SceneFive/mouth10-2-goo.png
  18. BIN Assets/Images/SceneFive/mouth11-1-b-fixed.png
  19. BIN Assets/Images/SceneFive/mouth11-1-b.png
  20. BIN Assets/Images/SceneFive/mouth11-2-b-fixed.png
  21. BIN Assets/Images/SceneFive/mouth11-2-b.png
  22. BIN Assets/Images/SceneFive/mouth12-1-bye-fixed.png
  23. BIN Assets/Images/SceneFive/mouth12-1-bye.png
  24. BIN Assets/Images/SceneFive/mouth12-2-bye-fixed.png
  25. BIN Assets/Images/SceneFive/mouth12-2-bye.png
  26. BIN Assets/Images/SceneFive/mouth13-1-ee-fixed.png
  27. BIN Assets/Images/SceneFive/mouth13-1-ee.png
  28. BIN Assets/Images/SceneFive/mouth13-2-ee-fixed.png
  29. BIN Assets/Images/SceneFive/mouth13-2-ee.png
  30. BIN Assets/Images/SceneFive/mouth2-1-th-fixed.png
  31. BIN Assets/Images/SceneFive/mouth2-1-th.png
  32. BIN Assets/Images/SceneFive/mouth2-2-th-fixed.png
  33. BIN Assets/Images/SceneFive/mouth2-2-th.png
  34. BIN Assets/Images/SceneFive/mouth3-1-th-fixed.png
  35. BIN Assets/Images/SceneFive/mouth3-1-th.png
  36. BIN Assets/Images/SceneFive/mouth3-2-th-fixed.png
  37. BIN Assets/Images/SceneFive/mouth3-2-th.png
  38. BIN Assets/Images/SceneFive/mouth4-1-is-fixed.png
  39. BIN Assets/Images/SceneFive/mouth4-1-is.png
  40. BIN Assets/Images/SceneFive/mouth4-2-is-fixed.png
  41. BIN Assets/Images/SceneFive/mouth4-2-is.png
  42. BIN Assets/Images/SceneFive/mouth5-1-O-fixed.png
  43. BIN Assets/Images/SceneFive/mouth5-1-O.png
  44. BIN Assets/Images/SceneFive/mouth5-2-O-fixed.png
  45. BIN Assets/Images/SceneFive/mouth5-2-O.png
  46. BIN Assets/Images/SceneFive/mouth6-1-UR-fixed.png
  47. BIN Assets/Images/SceneFive/mouth6-1-UR.png
  48. BIN Assets/Images/SceneFive/mouth6-2-UR-fixed.png
  49. BIN Assets/Images/SceneFive/mouth6-2-UR.png
  50. BIN Assets/Images/SceneFive/mouth7-1-UR-fixed.png
  51. BIN Assets/Images/SceneFive/mouth7-1-UR.png
  52. BIN Assets/Images/SceneFive/mouth7-2-UR-fixed.png
  53. BIN Assets/Images/SceneFive/mouth7-2-UR.png
  54. BIN Assets/Images/SceneFive/mouth8-1-ki-fixed.png
  55. BIN Assets/Images/SceneFive/mouth8-1-ki.png
  56. BIN Assets/Images/SceneFive/mouth8-2-ki-fixed.png
  57. BIN Assets/Images/SceneFive/mouth8-2-ki.png
  58. BIN Assets/Images/SceneFive/mouth9-1-ss-fixed.png
  59. BIN Assets/Images/SceneFive/mouth9-1-ss.png
  60. BIN Assets/Images/SceneFive/mouth9-2-ss-fixed.png
  61. BIN Assets/Images/SceneFive/mouth9-2-ss.png
  62. BIN Assets/Resources/SceneFive/FaceLeft.prefab
  63. BIN Assets/Resources/SceneFive/FaceRight.prefab
  64. BIN Assets/Resources/SceneFive/Lips.prefab
  65. BIN Assets/Resources/SceneFive/MouthLeft.prefab
  66. BIN Assets/Resources/SceneFive/MouthRight.prefab
  67. BIN Assets/Resources/SceneFive/PurpleQuad.prefab
  68. +5 −0 Assets/Scripts/Repeater.cs
  69. +5 −1 Assets/Scripts/SceneFactory.cs
  70. +133 −0 Assets/Scripts/Scenes/SceneFive.cs
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -44,5 +44,10 @@ public virtual void Update (float currentTime)
public float Length() {
return interval * ticks;
}
+
+ public void Reset(float time) {
+ currentTick = 0;
+ startTime = time;
+ }
}
@@ -4,6 +4,8 @@
public class SceneFactory : MarshalByRefObject {
SceneManager sceneManager;
+
+ Type LAST_SCENE = typeof(SceneFive);
public SceneFactory (SceneManager sceneManager) {
this.sceneManager = sceneManager;
@@ -19,7 +21,7 @@ public class SceneFactory : MarshalByRefObject {
}
public bool isLastScene(Scene scene) {
- if (scene.GetType() == typeof(SceneFour)) return true;
+ if (scene.GetType() == LAST_SCENE) return true;
return false;
}
@@ -35,6 +37,8 @@ public class SceneFactory : MarshalByRefObject {
return new SceneThree(sceneManager, ((SceneTwo) scene).room);
case "SceneThree":
return new SceneFour(sceneManager, ((SceneThree) scene).room);
+ case "SceneFour":
+ return new SceneFive(sceneManager);
}
throw new InvalidOperationException();
@@ -1 +1,134 @@
+using UnityEngine;
+using System;
+class SceneFive : Scene {
+ GameObject background;
+ GameObject faceLeft;
+ GameObject faceRight;
+
+ BigMouthAnimator bigMouthAnimator;
+ LipsAppear lips;
+
+ public SceneFive(SceneManager manager) : base(manager) {
+ }
+
+ public override void Setup () {
+ timeLength = 4.0f;
+ //endScene(); // no interaction required to continue
+
+ background = resourceFactory.Create(this, "PurpleQuad");
+ faceLeft = resourceFactory.Create(this, "FaceLeft");
+ var leftPosition = faceLeft.transform.position;
+ leftPosition.x = -5f;
+ leftPosition.y = -6f;
+ faceLeft.transform.position = leftPosition;
+
+ faceRight = resourceFactory.Create(this, "FaceRight");
+ var rightPosition = faceRight.transform.position;
+ rightPosition.x = 1f;
+ rightPosition.y = -6f;
+ faceRight.transform.position = rightPosition;
+
+ bigMouthAnimator = new BigMouthAnimator(resourceFactory);
+ lips = new LipsAppear(resourceFactory);
+ }
+
+ public override void Update () {
+ bigMouthAnimator.Update(Time.time);
+ lips.Update(Time.time);
+ }
+
+ public override void Destroy () {
+ GameObject.Destroy(background);
+ GameObject.Destroy(faceLeft);
+ GameObject.Destroy(faceRight);
+ bigMouthAnimator.Destroy();
+ lips.Destroy();
+ }
+
+ class LipsAppear : Repeater {
+ GameObject lips;
+
+ public LipsAppear(GameObjectFactory<string> resourceFactory) : base(0.5f) {
+ lips = resourceFactory.Create("SceneFive/Lips");
+ var lipsPosition = lips.transform.position;
+ lipsPosition.x = -6f;
+ lipsPosition.y = -5f;
+ lipsPosition.z = -1f;
+ lips.transform.position = lipsPosition;
+ lips.active = false;
+ }
+
+ public override void OnTick ()
+ {
+ if(currentTick > 6) {
+ lips.active = true;
+ }
+
+ if(currentTick == 8) {
+ Reset(Time.time);
+ lips.active = false;
+ }
+ }
+
+ public void Destroy() {
+ GameObject.Destroy(lips);
+ }
+
+
+ }
+
+ class BigMouthAnimator : Repeater {
+ GameObject mouthLeft;
+ GameObject mouthRight;
+ int delay = 1;
+ int frame = 0;
+
+ const int totalFrames = 8;
+
+ public BigMouthAnimator(GameObjectFactory<string> resourceFactory) : base(0.25f) {
+ mouthLeft = resourceFactory.Create("SceneFive/MouthLeft");
+ var leftPosition = mouthLeft.transform.position;
+ leftPosition.x = -2.95f;
+ leftPosition.y = -5.6f;
+ leftPosition.z = -0.5f;
+ mouthLeft.transform.position = leftPosition;
+
+ mouthRight = resourceFactory.Create("SceneFive/MouthRight");
+ var rightPosition = mouthRight.transform.position;
+ rightPosition.x = 1f;
+ rightPosition.y = -5.6f;
+ rightPosition.z = -0.5f;
+ mouthRight.transform.position = rightPosition;
+ }
+
+ public override void OnTick() {
+ if (delay > 0) {
+ delay -= 1;
+ return;
+ }
+
+ moveMouth(0, 4);
+ moveMouth(5, 10);
+ moveMouth(10, 11);
+
+ incrementFrame();
+ }
+
+ public void Destroy() {
+ GameObject.Destroy(mouthLeft);
+ GameObject.Destroy(mouthRight);
+ }
+
+ private void incrementFrame() {
+ frame = (frame + 1) % totalFrames;
+ }
+
+ private void moveMouth(int start, int end) {
+ if(frame > start && frame < end) {
+ mouthLeft.GetComponent<Sprite>().NextTexture();
+ mouthRight.GetComponent<Sprite>().NextTexture();
+ }
+ }
+ }
+}

0 comments on commit 2000438

Please sign in to comment.