SceneDowntownCloudNine.cs 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973
  1. //================================================================================
  2. //
  3. //================================================================================
  4. using UnityEngine;
  5. using System.Collections;
  6. //================================================================================
  7. //
  8. //================================================================================
  9. namespace ReaderRabbit
  10. {
  11. //================================================================================
  12. //
  13. //================================================================================
  14. public class SceneDowntownCloudNine : SceneCommon
  15. {
  16. //================================================================================
  17. //
  18. //================================================================================
  19. private enum Characters
  20. {
  21. Reader = CharactersCommon.Reader,
  22. Sam = CharactersCommon.Sam,
  23. Paige = CharactersCommon.Paige,
  24. Chester = CharactersCommon.Chester,
  25. QueenCumulus = CharactersCommon.StartSceneSpecific,
  26. }
  27. //================================================================================
  28. //
  29. //================================================================================
  30. private const int READER_FROM_RAINGEAR_THROWING_MACHINE = (int)ReaderAnimation.AnimationCycles.Misc1 + 1;
  31. private const int SAM_FROM_RAINGEAR_THROWING_MACHINE = (int)SamAnimation.AnimationCycles.Misc1 + 1;
  32. private const int QUEEN_CUMULUS_MAX_CLICK_COUNT = 3;
  33. private int m_QueenCumulusClickCount;
  34. private const int PAIGE_MAX_CLICK_COUNT = 3;
  35. private int m_PaigeClickCount;
  36. private bool m_IsReaderFirstClick;
  37. private int m_ItemsCollected;
  38. private const int GAME_STATE_DID_NOT_VISIT_ISLAND = 2;
  39. private const int GAME_STATE_AFTER_VISITING_ISLAND = 3;
  40. private const int GAME_STATE_AFTER_VISITING_IRVINS_HOUSE = 4;
  41. private const int GAME_STATE_ONE_ITEM = 5;
  42. private const int GAME_STATE_TWO_ITEMS = 6;
  43. private const int GAME_STATE_THREE_ITEMS = 7;
  44. private int m_GameState;
  45. [SerializeField] private GameObject[] m_LitterFrames;
  46. public GameObject cloundNineArtGallerySign;
  47. public bool reactivateInteractions = false; //mycode --rafael
  48. //================================================================================
  49. //
  50. //================================================================================
  51. protected override void Start()
  52. {
  53. base.Start();
  54. //============================================================================
  55. //
  56. //============================================================================
  57. int lang = PlayerPrefs.GetInt("language");
  58. if (lang == 0)
  59. m_SpeechFolder = "Resources_DA/Audio/DowntownCloudNine_Speech";
  60. else if (lang == 1)
  61. m_SpeechFolder = "Resources_EN/Audio/DowntownCloudNine_Speech";
  62. else if (lang == 2)
  63. m_SpeechFolder = "Resources_NO/Audio/DowntownCloudNine_Speech";
  64. else if (lang == 3)
  65. m_SpeechFolder = "Resources_SP/Audio/DowntownCloudNine_Speech";
  66. else if (lang == 4)
  67. m_SpeechFolder = "Resources_SW/Audio/DowntownCloudNine_Speech";
  68. //============================================================================
  69. //
  70. //============================================================================
  71. PlayerData.Instance().SetVisitedDowntownCloudNine(true);
  72. PlayerData.Instance().SetCurrentLocation(Location.DowntownCloudNine);
  73. AudioManager.Instance().PlayBGM("BGM_DowntownCloudNine_15000");
  74. m_QueenCumulusClickCount = 0;
  75. m_PaigeClickCount = 0;
  76. m_IsReaderFirstClick = true;
  77. m_ItemsCollected = 0;
  78. if (PlayerData.Instance().GetRubberBand() != ItemState.None)
  79. ++m_ItemsCollected;
  80. if (PlayerData.Instance().GetHoop() != ItemState.None)
  81. ++m_ItemsCollected;
  82. if (PlayerData.Instance().GetPillow() != ItemState.None)
  83. ++m_ItemsCollected;
  84. m_GameState = 0;
  85. if (m_ItemsCollected == 0)
  86. {
  87. switch (PlayerData.Instance().DCN_BackType)
  88. {
  89. case DCN_BackTypeEnum.DidNotVisitIsland:
  90. case DCN_BackTypeEnum.DidNotVisitIslandFirstTimeOnly:
  91. m_GameState = GAME_STATE_DID_NOT_VISIT_ISLAND;
  92. break;
  93. case DCN_BackTypeEnum.AfterVisitingIsland:
  94. case DCN_BackTypeEnum.AfterVisitingIslandFirstTimeOnly:
  95. m_GameState = GAME_STATE_AFTER_VISITING_ISLAND;
  96. break;
  97. case DCN_BackTypeEnum.AfterVisitingIrvinsHouseFirstTimeOnly:
  98. case DCN_BackTypeEnum.AfterVisitingIrvinsHouse:
  99. m_GameState = GAME_STATE_AFTER_VISITING_IRVINS_HOUSE;
  100. break;
  101. }
  102. }
  103. else if (m_ItemsCollected == 1)
  104. {
  105. m_GameState = GAME_STATE_ONE_ITEM;
  106. }
  107. else if (m_ItemsCollected == 2)
  108. {
  109. m_GameState = GAME_STATE_TWO_ITEMS;
  110. }
  111. else if (m_ItemsCollected == 3)
  112. {
  113. m_GameState = GAME_STATE_THREE_ITEMS;
  114. }
  115. if (PlayerData.Instance().GetPreviousLocation() == Location.RaingearThrowingMachine)
  116. ++PlayerData.Instance().DCN_EnteredFromCatapult;
  117. UpdateOnce();
  118. }
  119. void ReactivateSceneInteractions(){ //mycode --rafael
  120. foreach (RRInteractiveRectangle intRetangle in m_NavigationRectangles){ //mycode --rafael
  121. intRetangle.canInteracte = true;
  122. }
  123. foreach (RRInteractiveRectangle intCharacterRetangle in m_CharacterRectangles){ //mycode --rafael
  124. intCharacterRetangle.canInteracte = true;
  125. }
  126. foreach (RRInteractiveRectangle intOtherCharacterRetangle in m_OtherCharacterRectangles){ //mycode --rafael
  127. intOtherCharacterRetangle.canInteracte = true;
  128. }
  129. }
  130. void CheckSceneStage(){ //mycode --rafael
  131. if (reactivateInteractions == false){
  132. if (!m_IsFirstTime){
  133. ReactivateSceneInteractions();
  134. }
  135. reactivateInteractions = true;
  136. }
  137. }
  138. protected override void Update(){ //mycode --rafael
  139. base.Update();
  140. CheckSceneStage();
  141. }
  142. //================================================================================
  143. //
  144. //================================================================================
  145. public override void UpdateOnce()
  146. {
  147. // Hide/show litter frames according to visited places/items.
  148. if (m_GameState == GAME_STATE_AFTER_VISITING_ISLAND || m_GameState == GAME_STATE_AFTER_VISITING_IRVINS_HOUSE)
  149. {
  150. m_LitterFrames[0].gameObject.SetActive(true);
  151. m_LitterFrames[1].gameObject.SetActive(false);
  152. m_LitterFrames[2].gameObject.SetActive(false);
  153. }
  154. else if (m_GameState == GAME_STATE_ONE_ITEM || m_GameState == GAME_STATE_TWO_ITEMS)
  155. {
  156. m_LitterFrames[0].gameObject.SetActive(true);
  157. m_LitterFrames[1].gameObject.SetActive(true);
  158. m_LitterFrames[2].gameObject.SetActive(false);
  159. }
  160. else if (m_GameState == GAME_STATE_THREE_ITEMS)
  161. {
  162. m_LitterFrames[0].gameObject.SetActive(true);
  163. m_LitterFrames[1].gameObject.SetActive(true);
  164. m_LitterFrames[2].gameObject.SetActive(true);
  165. }
  166. else
  167. {
  168. // Hide.
  169. m_LitterFrames[0].gameObject.SetActive(false);
  170. m_LitterFrames[1].gameObject.SetActive(false);
  171. m_LitterFrames[2].gameObject.SetActive(false);
  172. }
  173. }
  174. //================================================================================
  175. //
  176. //================================================================================
  177. protected override void OnNavigation()
  178. {
  179. if (m_CurrentInteractiveRectangle.GetActionParameter(0) == "CloudNineArtGallery"
  180. && PlayerData.Instance().DCN_IsFirstClickCloudNineArtGallery)
  181. {
  182. PlayerData.Instance().DCN_IsFirstClickCloudNineArtGallery = false;
  183. NewSequence();
  184. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15500");
  185. SetSequence(1, EventSequenceItem.EventSequenceType.Callback, GotoCloudNineArtGallery);
  186. StartSequence(2, false);
  187. }
  188. else
  189. {
  190. base.OnNavigation();
  191. }
  192. }
  193. //================================================================================
  194. //
  195. //================================================================================
  196. void GotoCloudNineArtGallery()
  197. {
  198. KishiTechUnity.Loading.Loading.Instance().Show();
  199. SetCurrentToNavigation("CloudNineArtGallery");
  200. base.OnNavigation();
  201. }
  202. //================================================================================
  203. //
  204. //================================================================================
  205. protected override void PlayFirstEvent()
  206. {
  207. UpdateOnce();
  208. if (m_IsFirstTime)
  209. {
  210. SceneFirstSequencePart1();
  211. }
  212. else
  213. {
  214. if (PlayerData.Instance().GetPreviousLocation() == Location.RaingearThrowingMachine)
  215. {
  216. int sequence = 0;
  217. NewSequence();
  218. SetSequence(sequence++, EventSequenceItem.EventSequenceType.AnimationNoWait,
  219. Characters.Reader,
  220. READER_FROM_RAINGEAR_THROWING_MACHINE,
  221. m_CharacterAnimations[(int)Characters.Reader].AnimationCyclesString[READER_FROM_RAINGEAR_THROWING_MACHINE]);
  222. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Animation,
  223. Characters.Sam,
  224. SAM_FROM_RAINGEAR_THROWING_MACHINE,
  225. m_CharacterAnimations[(int)Characters.Sam].AnimationCyclesString[SAM_FROM_RAINGEAR_THROWING_MACHINE]);
  226. if (PlayerData.Instance().DCN_EnteredFromCatapult > 4)
  227. PlayerData.Instance().DCN_EnteredFromCatapult = 1;
  228. if (PlayerData.Instance().DCN_EnteredFromCatapult == 1)
  229. {
  230. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15150");
  231. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15151");
  232. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15152");
  233. }
  234. else if (PlayerData.Instance().DCN_EnteredFromCatapult == 2)
  235. {
  236. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15155");
  237. }
  238. else if (PlayerData.Instance().DCN_EnteredFromCatapult == 3)
  239. {
  240. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15156");
  241. }
  242. else if (PlayerData.Instance().DCN_EnteredFromCatapult == 4)
  243. {
  244. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15157");
  245. }
  246. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, ReentrySpeechDelayed);
  247. StartSequence(sequence);
  248. }
  249. else
  250. {
  251. ReentrySpeech();
  252. }
  253. }
  254. }
  255. //================================================================================
  256. //
  257. //================================================================================
  258. void ReentrySpeechDelayed()
  259. {
  260. Invoke("ReentrySpeech", 0.1f);
  261. }
  262. //================================================================================
  263. //
  264. //================================================================================
  265. void ReentrySpeech()
  266. {
  267. if (m_ItemsCollected == 0)
  268. {
  269. switch (PlayerData.Instance().DCN_BackType)
  270. {
  271. case DCN_BackTypeEnum.DidNotVisitIslandFirstTimeOnly:
  272. SpeechBackDidNotVisitIslandFirstTimeOnly();
  273. break;
  274. case DCN_BackTypeEnum.AfterVisitingIslandFirstTimeOnly:
  275. SpeechBackAfterVisitingIslandFirstTimeOnly();
  276. break;
  277. case DCN_BackTypeEnum.AfterVisitingIrvinsHouseFirstTimeOnly:
  278. SpeechBackAfterVisitingIrvinsHouseFirstTimeOnly();
  279. break;
  280. case DCN_BackTypeEnum.AfterVisitingIrvinsHouse:
  281. SpeechBackAfterVisitingIrvinsHouse();
  282. break;
  283. }
  284. }
  285. else
  286. {
  287. if (m_GameState == GAME_STATE_ONE_ITEM)
  288. {
  289. SpeechBackOneItem();
  290. }
  291. else if (m_GameState == GAME_STATE_TWO_ITEMS)
  292. {
  293. SpeechBackTwoItems();
  294. }
  295. else if (m_GameState == GAME_STATE_THREE_ITEMS)
  296. {
  297. SpeechBackThreeItems();
  298. }
  299. }
  300. }
  301. //================================================================================
  302. //
  303. //================================================================================
  304. void SceneFirstSequencePart1()
  305. {
  306. UpdateIdleDelay();
  307. NewSequence();
  308. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15100");
  309. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15300");
  310. SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15301");
  311. SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15302");
  312. SetSequence(4, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15303");
  313. SetSequence(5, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15304");
  314. SetSequence(6, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15305");
  315. SetSequence(7, EventSequenceItem.EventSequenceType.Callback, SceneFirstSequencePart2);
  316. StartSequence(8);
  317. }
  318. //================================================================================
  319. //
  320. //================================================================================
  321. void SceneFirstSequencePart2()
  322. {
  323. UpdateIdleDelay();
  324. AudioManager.Instance().PlayBGM("BGM_DowntownCloudNine_15390");
  325. Invoke("StartSceneFirstSequencePart2", 0.1f);
  326. }
  327. //================================================================================
  328. //
  329. //================================================================================
  330. void StartSceneFirstSequencePart2()
  331. {
  332. UpdateIdleDelay();
  333. NewSequence();
  334. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15306");
  335. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15307");
  336. SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15308");
  337. SetSequence(3, EventSequenceItem.EventSequenceType.Callback, SceneFirstSequencePart3);
  338. StartSequence(4);
  339. }
  340. //================================================================================
  341. //
  342. //================================================================================
  343. void SceneFirstSequencePart3()
  344. {
  345. UpdateIdleDelay();
  346. Invoke("StartSceneFirstSequencePart3", 0.1f);
  347. }
  348. //================================================================================
  349. //
  350. //================================================================================
  351. void StartSceneFirstSequencePart3()
  352. {
  353. UpdateIdleDelay();
  354. NewSequence();
  355. SetSequence(0, EventSequenceItem.EventSequenceType.Video, VideoType.QueenCumulus);
  356. SetSequence(1, EventSequenceItem.EventSequenceType.Callback, SceneFirstSequencePart4);
  357. StartSequence(2);
  358. }
  359. //================================================================================
  360. //
  361. //================================================================================
  362. void SceneFirstSequencePart4()
  363. {
  364. UpdateIdleDelay();
  365. AudioManager.Instance().PlayBGM("BGM_DowntownCloudNine_15391");
  366. Invoke("StartSceneFirstSequencePart4", 0.1f);
  367. }
  368. //================================================================================
  369. //
  370. //================================================================================
  371. void StartSceneFirstSequencePart4()
  372. {
  373. UpdateIdleDelay();
  374. NewSequence();
  375. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15310");
  376. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15312");
  377. SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15314");
  378. SetSequence(3, EventSequenceItem.EventSequenceType.Callback, SceneFirstSequencePart5);
  379. StartSequence(4);
  380. }
  381. //================================================================================
  382. //
  383. //================================================================================
  384. void SceneFirstSequencePart5()
  385. {
  386. UpdateIdleDelay();
  387. Invoke("StartSceneFirstSequencePart5", 0.1f);
  388. }
  389. //================================================================================
  390. //
  391. //================================================================================
  392. void StartSceneFirstSequencePart5()
  393. {
  394. UpdateIdleDelay();
  395. NewSequence();
  396. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15316");
  397. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15318");
  398. SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15319");
  399. SetSequence(3, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
  400. SetSequence(4, EventSequenceItem.EventSequenceType.Callback, UpdateIdleDelay);
  401. StartSequence(5);
  402. ReactivateSceneInteractions(); //mycode --rafael
  403. }
  404. //================================================================================
  405. //
  406. //================================================================================
  407. void SpeechBackDidNotVisitIslandFirstTimeOnly()
  408. {
  409. PlayerData.Instance().DCN_BackType = DCN_BackTypeEnum.DidNotVisitIsland;
  410. NewSequence();
  411. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15166");
  412. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15167");
  413. SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15168");
  414. SetSequence(3, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
  415. SetSequence(4, EventSequenceItem.EventSequenceType.Callback, UpdateIdleDelay);
  416. StartSequence(5);
  417. }
  418. //================================================================================
  419. //
  420. //================================================================================
  421. void SpeechBackAfterVisitingIslandFirstTimeOnly()
  422. {
  423. PlayerData.Instance().DCN_BackType = DCN_BackTypeEnum.AfterVisitingIsland;
  424. NewSequence();
  425. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15170");
  426. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15171");
  427. SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15172");
  428. SetSequence(3, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
  429. SetSequence(4, EventSequenceItem.EventSequenceType.Callback, UpdateIdleDelay);
  430. StartSequence(5);
  431. }
  432. //================================================================================
  433. //
  434. //================================================================================
  435. void SpeechBackAfterVisitingIrvinsHouseFirstTimeOnly()
  436. {
  437. PlayerData.Instance().DCN_BackType = DCN_BackTypeEnum.AfterVisitingIrvinsHouse;
  438. NewSequence();
  439. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15175");
  440. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15176");
  441. SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15177");
  442. SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15178");
  443. SetSequence(4, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15179");
  444. SetSequence(5, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15180");
  445. SetSequence(6, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15181");
  446. SetSequence(7, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15182");
  447. SetSequence(8, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15183");
  448. SetSequence(9, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15184");
  449. SetSequence(10, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15185");
  450. SetSequence(11, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
  451. SetSequence(12, EventSequenceItem.EventSequenceType.Callback, UpdateIdleDelay);
  452. StartSequence(13);
  453. }
  454. //================================================================================
  455. //
  456. //================================================================================
  457. void SpeechBackAfterVisitingIrvinsHouse()
  458. {
  459. NewSequence();
  460. if (PlayerData.Instance().DCN_BackAfterIrvinsHouseQueenSpeech == 0)
  461. {
  462. PlayerData.Instance().DCN_BackAfterIrvinsHouseQueenSpeech = 1;
  463. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15190");
  464. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15191");
  465. StartSequence(2);
  466. }
  467. else
  468. {
  469. PlayerData.Instance().DCN_BackAfterIrvinsHouseQueenSpeech = 0;
  470. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15192");
  471. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15193");
  472. StartSequence(2);
  473. }
  474. }
  475. //================================================================================
  476. //
  477. //================================================================================
  478. void SpeechBackOneItem()
  479. {
  480. if (PlayerData.Instance().DCN_BackAfterOneItem)
  481. {
  482. PlayerData.Instance().DCN_BackAfterOneItem = false;
  483. NewSequence();
  484. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15195");
  485. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15196");
  486. SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15197");
  487. StartSequence(3);
  488. }
  489. }
  490. //================================================================================
  491. //
  492. //================================================================================
  493. void SpeechBackTwoItems()
  494. {
  495. if (PlayerData.Instance().DCN_BackAfterTwoItems)
  496. {
  497. PlayerData.Instance().DCN_BackAfterTwoItems = false;
  498. NewSequence();
  499. int sequence = 0;
  500. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15200");
  501. if (PlayerData.Instance().GetHoop() == ItemState.None)
  502. {
  503. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15201");
  504. }
  505. else if (PlayerData.Instance().GetRubberBand() == ItemState.None)
  506. {
  507. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15202");
  508. }
  509. else if (PlayerData.Instance().GetPillow() == ItemState.None)
  510. {
  511. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15203");
  512. }
  513. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15204");
  514. StartSequence(sequence);
  515. }
  516. else
  517. {
  518. NewSequence();
  519. int sequence = 0;
  520. if (PlayerData.Instance().GetHoop() == ItemState.None)
  521. {
  522. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15210");
  523. }
  524. else if (PlayerData.Instance().GetRubberBand() == ItemState.None)
  525. {
  526. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15211");
  527. }
  528. else if (PlayerData.Instance().GetPillow() == ItemState.None)
  529. {
  530. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15212");
  531. }
  532. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15191");
  533. StartSequence(sequence);
  534. }
  535. }
  536. //================================================================================
  537. //
  538. //================================================================================
  539. void SpeechBackThreeItems()
  540. {
  541. if (PlayerData.Instance().DCN_BackAfterThreeItems)
  542. {
  543. PlayerData.Instance().DCN_BackAfterThreeItems = false;
  544. NewSequence();
  545. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15220");
  546. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15221");
  547. SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15222");
  548. SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15223");
  549. SetSequence(4, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15224");
  550. StartSequence(5);
  551. }
  552. else
  553. {
  554. NewSequence();
  555. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15230");
  556. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15231");
  557. SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15232");
  558. StartSequence(3);
  559. }
  560. }
  561. //================================================================================
  562. //
  563. //================================================================================
  564. protected override void OnOtherCharacterInteraction()
  565. {
  566. if (m_CurrentInteractiveRectangle.GetActionParameter(0) == "QueenCumulus")
  567. {
  568. switch (m_QueenCumulusClickCount)
  569. {
  570. case 0:
  571. QueenCumulusClick0();
  572. break;
  573. case 1:
  574. QueenCumulusClick1();
  575. break;
  576. case 2:
  577. QueenCumulusClick2();
  578. break;
  579. case 3:
  580. QueenCumulusClick3();
  581. break;
  582. }
  583. ++m_QueenCumulusClickCount;
  584. if (m_QueenCumulusClickCount > QUEEN_CUMULUS_MAX_CLICK_COUNT)
  585. m_QueenCumulusClickCount = 1;
  586. }
  587. }
  588. //================================================================================
  589. //
  590. //================================================================================
  591. void QueenCumulusClick0()
  592. {
  593. switch (m_GameState)
  594. {
  595. case GAME_STATE_DID_NOT_VISIT_ISLAND:
  596. NewSequence();
  597. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15325");
  598. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15326");
  599. SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15327");
  600. SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15328");
  601. StartSequence(4);
  602. break;
  603. case GAME_STATE_AFTER_VISITING_ISLAND:
  604. NewSequence();
  605. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15335");
  606. StartSequence(1);
  607. break;
  608. case GAME_STATE_THREE_ITEMS:
  609. NewSequence();
  610. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15231");
  611. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15232");
  612. StartSequence(2);
  613. break;
  614. case GAME_STATE_AFTER_VISITING_IRVINS_HOUSE:
  615. case GAME_STATE_ONE_ITEM:
  616. case GAME_STATE_TWO_ITEMS:
  617. if (PlayerData.Instance().GetHoop() == ItemState.None)
  618. {
  619. NewSequence();
  620. int sequence = 0;
  621. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15340");
  622. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15341");
  623. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15342");
  624. bool didTalkToRockHead = true;
  625. if (didTalkToRockHead)
  626. {
  627. if (PlayerData.Instance().GetLadder() == ItemState.None)
  628. {
  629. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15345");
  630. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15346");
  631. }
  632. }
  633. StartSequence(sequence);
  634. }
  635. else if (PlayerData.Instance().GetRubberBand() == ItemState.None)
  636. {
  637. NewSequence();
  638. int sequence = 0;
  639. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15355");
  640. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15356");
  641. if (PlayerData.Instance().DidVisitNewspaperCarrierScene() && PlayerData.Instance().GetWagon() == ItemState.None)
  642. {
  643. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15357");
  644. SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15358");
  645. }
  646. StartSequence(sequence);
  647. }
  648. else if (PlayerData.Instance().GetPillow() == ItemState.None)
  649. {
  650. NewSequence();
  651. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15360");
  652. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15361");
  653. StartSequence(2);
  654. }
  655. else if (PlayerData.Instance().GetWhistle() == ItemState.None)
  656. {
  657. NewSequence();
  658. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15350");
  659. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15351");
  660. StartSequence(2);
  661. }
  662. break;
  663. }
  664. }
  665. //================================================================================
  666. //
  667. //================================================================================
  668. void QueenCumulusClick1()
  669. {
  670. NewSequence();
  671. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15370");
  672. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15371");
  673. SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15372");
  674. StartSequence(3);
  675. }
  676. //================================================================================
  677. //
  678. //================================================================================
  679. void QueenCumulusClick2()
  680. {
  681. NewSequence();
  682. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15375");
  683. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15376");
  684. SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15377");
  685. StartSequence(3);
  686. }
  687. //================================================================================
  688. //
  689. //================================================================================
  690. void QueenCumulusClick3()
  691. {
  692. NewSequence();
  693. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15380");
  694. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.QueenCumulus, "15381");
  695. StartSequence(2);
  696. }
  697. //================================================================================
  698. //
  699. //================================================================================
  700. public override void SpeechReader()
  701. {
  702. if (m_IsReaderFirstClick)
  703. {
  704. m_IsReaderFirstClick = false;
  705. switch (m_GameState)
  706. {
  707. case GAME_STATE_DID_NOT_VISIT_ISLAND:
  708. NewSequence();
  709. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15451");
  710. StartSequence(1);
  711. break;
  712. case GAME_STATE_AFTER_VISITING_ISLAND:
  713. NewSequence();
  714. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15452");
  715. StartSequence(1);
  716. break;
  717. case GAME_STATE_AFTER_VISITING_IRVINS_HOUSE:
  718. NewSequence();
  719. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15453");
  720. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15454");
  721. StartSequence(2);
  722. break;
  723. case GAME_STATE_ONE_ITEM:
  724. NewSequence();
  725. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15455");
  726. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15456");
  727. StartSequence(2);
  728. break;
  729. case GAME_STATE_TWO_ITEMS:
  730. NewSequence();
  731. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15457");
  732. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15456");
  733. StartSequence(2);
  734. break;
  735. case GAME_STATE_THREE_ITEMS:
  736. NewSequence();
  737. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15470");
  738. StartSequence(1);
  739. break;
  740. }
  741. }
  742. else
  743. {
  744. ReaderRandomSpeech(true);
  745. }
  746. }
  747. //================================================================================
  748. //
  749. //================================================================================
  750. public override void ReaderRandomSpeech(bool ignoreSomebodySpeaking)
  751. {
  752. if (ignoreSomebodySpeaking || !IsSomebodySpeaking())
  753. {
  754. int maxRandom = 200;
  755. if (m_GameState == GAME_STATE_DID_NOT_VISIT_ISLAND || m_GameState == GAME_STATE_AFTER_VISITING_ISLAND)
  756. maxRandom = 100;
  757. else if (m_GameState == GAME_STATE_THREE_ITEMS)
  758. maxRandom = 0;
  759. if (maxRandom > 0)
  760. {
  761. NewSequence();
  762. int randomValue = Random.Range(0, maxRandom);
  763. if (randomValue < 50)
  764. {
  765. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15250");
  766. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15251");
  767. StartSequence(2);
  768. }
  769. else if (randomValue < 100)
  770. {
  771. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15260");
  772. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15261");
  773. StartSequence(2);
  774. }
  775. else if (randomValue < 150)
  776. {
  777. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15453");
  778. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15454");
  779. StartSequence(2);
  780. }
  781. else
  782. {
  783. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15455");
  784. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15456");
  785. StartSequence(2);
  786. }
  787. }
  788. }
  789. }
  790. //================================================================================
  791. //
  792. //================================================================================
  793. public override void SpeechPaige()
  794. {
  795. NewSequence();
  796. if (m_GameState == GAME_STATE_DID_NOT_VISIT_ISLAND)
  797. {
  798. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "15405");
  799. StartSequence(1);
  800. m_PaigeClickCount = 1;
  801. }
  802. else if (m_GameState == GAME_STATE_THREE_ITEMS)
  803. {
  804. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "15420");
  805. StartSequence(1);
  806. }
  807. else
  808. {
  809. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "1541" + (m_PaigeClickCount - 1).ToString());
  810. StartSequence(1);
  811. ++m_PaigeClickCount;
  812. if (m_PaigeClickCount > PAIGE_MAX_CLICK_COUNT)
  813. m_PaigeClickCount = 1;
  814. }
  815. }
  816. //================================================================================
  817. //
  818. //================================================================================
  819. protected override void OnIdle()
  820. {
  821. NewSequence();
  822. int maxRandom = (m_GameState > 0) ? 150 : 100;
  823. int randomValue = Random.Range(0, maxRandom);
  824. if (randomValue < 50)
  825. {
  826. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15250");
  827. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15251");
  828. SetSequence(2, EventSequenceItem.EventSequenceType.Callback, UpdateIdleDelay);
  829. StartSequence(3);
  830. }
  831. else if (randomValue < 100)
  832. {
  833. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15270");
  834. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15271");
  835. SetSequence(2, EventSequenceItem.EventSequenceType.Callback, UpdateIdleDelay);
  836. StartSequence(3);
  837. }
  838. else
  839. {
  840. SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "15260");
  841. SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "15261");
  842. SetSequence(2, EventSequenceItem.EventSequenceType.Callback, UpdateIdleDelay);
  843. StartSequence(3);
  844. }
  845. }
  846. } // public class SceneDowntownCloudNine : SceneCommon
  847. } // namespace ReaderRabbit