123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600 |
- //================================================================================
- //
- //================================================================================
- using UnityEngine;
- using System.Collections;
- //================================================================================
- //
- //================================================================================
- namespace ReaderRabbit
- {
- //================================================================================
- //
- //================================================================================
- public class SceneRaingearThrowingMachine : SceneCommon
- {
- //================================================================================
- //
- //================================================================================
- private enum Characters
- {
- Reader = CharactersCommon.Reader,
- Sam = CharactersCommon.Sam,
- Paige = CharactersCommon.Paige,
- Chester = CharactersCommon.Chester,
- Fluffy = CharactersCommon.StartSceneSpecific,
- RaingearThrowingMachine,
- }
- //================================================================================
- //
- //================================================================================
- private enum Items
- {
- Sandwich = 0,
- Bowl,
- }
- //================================================================================
- //
- //================================================================================
- private const int READER_CATAPULT = (int)ReaderAnimation.AnimationCycles.Misc1 + 1;
- //================================================================================
- //
- //================================================================================
- protected override void Start()
- {
- base.Start();
- //============================================================================
- //
- //============================================================================
- int lang = PlayerPrefs.GetInt("language");
- if (lang == 0)
- m_SpeechFolder = "Resources_DA/Audio/RaingearThrowingMachine_Speech";
- else if (lang == 1)
- m_SpeechFolder = "Resources_EN/Audio/RaingearThrowingMachine_Speech";
- else if (lang == 2)
- m_SpeechFolder = "Resources_NO/Audio/RaingearThrowingMachine_Speech";
- else if (lang == 3)
- m_SpeechFolder = "Resources_SP/Audio/RaingearThrowingMachine_Speech";
- else if (lang == 4)
- m_SpeechFolder = "Resources_SW/Audio/RaingearThrowingMachine_Speech";
- //============================================================================
- //
- //============================================================================
- PlayerData.Instance().SetVisitedRaingearThrowingMachine(true);
- PlayerData.Instance().SetCurrentLocation(Location.RaingearThrowingMachine);
- AudioManager.Instance().PlayBGM("BGM_RaingearThrowingMachine");
- }
- //================================================================================
- //
- //================================================================================
- public override void UpdateOnce()
- {
- if (PlayerData.Instance().RTM_IsCatapultReady)
- EnableNavigation("RaingearIslandRainbow");
- else
- DisableNavigation("RaingearIslandRainbow");
- m_Items[(int)Items.Bowl].gameObject.SetActive(!PlayerData.Instance().RTM_IsFluffySleeping);
- m_Items[(int)Items.Sandwich].gameObject.SetActive(false);
- m_CharacterAnimations[(int)Characters.Fluffy].ChangeToIdle();
- if (PlayerData.Instance().RTM_IsFluffySleeping)
- ((RTM_FluffyAnimation)m_CharacterAnimations[(int)Characters.Fluffy]).PlaySleepAnimation();
- }
- //================================================================================
- //
- //================================================================================
- protected override void PlayFirstEvent()
- {
- if (PlayerData.Instance().RTM_IsCatapultReady)
- EnableNavigation("RaingearIslandRainbow");
- else
- DisableNavigation("RaingearIslandRainbow");
- m_Items[(int)Items.Bowl].gameObject.SetActive(!PlayerData.Instance().RTM_IsFluffySleeping);
- m_Items[(int)Items.Sandwich].gameObject.SetActive(false);
- m_CharacterAnimations[(int)Characters.Fluffy].ChangeToIdle();
- if (PlayerData.Instance().RTM_VisitCount < 4)
- ++PlayerData.Instance().RTM_VisitCount;
- if (m_IsFirstTime)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28150");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28151");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28152");
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28153");
- StartSequence(4);
- }
- else
- {
- if (PlayerData.Instance().RTM_IsFluffySleeping)
- {
- if (PlayerData.Instance().RTM_IsCatapultReady)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28210");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28211");
- StartSequence(2);
- }
- }
- else
- {
- if (PlayerData.Instance().RTM_VisitCount < 4)
- {
- switch (PlayerData.Instance().RTM_VisitCount)
- {
- case 1:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28200");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28201");
- StartSequence(2);
- break;
- case 2:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28202");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Fluffy, "28250");
- StartSequence(2);
- break;
- case 3:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28204");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28205");
- StartSequence(2);
- break;
- }
- }
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnIdle()
- {
- if (PlayerData.Instance().RTM_IsFluffySleeping)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "28253");
- StartSequence(1);
- }
- else
- {
- string[] possibleNumbers = { "0", "1", "2" };
- string randomPhraseNumber = possibleNumbers[Random.Range(0, possibleNumbers.Length)];
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Fluffy, "2825" + randomPhraseNumber);
- StartSequence(1);
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void SpeechReader()
- {
- if (PlayerData.Instance().RTM_IsFluffySleeping)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28363");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28364");
- StartSequence(2);
- }
- else
- {
- if (PlayerData.Instance().RTM_UsedCatapultCount == 0)
- {
- int randomValue = Random.Range(0, 100);
- if (randomValue < 50)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28355");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28356");
- StartSequence(2);
- }
- else
- {
- if (PlayerData.Instance().GetSandwich() == ItemState.Inventory)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28350");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28352");
- StartSequence(2);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28350");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28351");
- StartSequence(2);
- }
- }
- }
- else
- {
- int randomValue = Random.Range(0, 150);
- if (randomValue < 50)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28357");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28358");
- StartSequence(2);
- }
- else if (randomValue < 100)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28359");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28360");
- StartSequence(2);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28361");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28362");
- StartSequence(2);
- }
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void SpeechPaige()
- {
- if (PlayerData.Instance().RTM_IsFluffySleeping)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "28253");
- StartSequence(1);
- }
- else
- {
- string[] possibleNumbers = { "0", "1", "2", "3" };
- string randomPhraseNumber = possibleNumbers[Random.Range(0, possibleNumbers.Length)];
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "2830" + randomPhraseNumber);
- StartSequence(1);
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnOtherCharacterInteraction()
- {
- if (m_CurrentInteractiveRectangle.GetActionParameter(0) == "Fluffy")
- {
- PlaySpeechFluffy();
- }
- }
- //================================================================================
- //
- //================================================================================
- private void PlaySpeechFluffy()
- {
- if (!PlayerData.Instance().RTM_IsFluffySleeping)
- {
- int randomValue = Random.Range(0, 150);
- if (randomValue < 50)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Fluffy, "28250");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28400");
- StartSequence(2);
- }
- else if (randomValue < 100)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Fluffy, "28251");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28205");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28401");
- StartSequence(3);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Fluffy, "28252");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28402");
- StartSequence(2);
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- public void PlaySpeechBowl()
- {
- int randomValue = Random.Range(0, 100);
- if (randomValue < 50)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28405");
- StartSequence(1);
- }
- else
- {
- if (PlayerData.Instance().GetSandwich() == ItemState.Inventory)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28406");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28352");
- StartSequence(2);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28406");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28351");
- StartSequence(2);
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnRightItemUsedInScene(ItemEnum item)
- {
- base.OnRightItemUsedInScene(item);
- if (PlayerData.Instance().RTM_IsFluffySleeping)
- {
- Characters[] characters = {
- Characters.Sam,
- Characters.Reader,
- Characters.Sam,
- Characters.Reader
- };
- string[] possibleNumbers = { "7010", "7011", "7012", "7013" };
- int randomValue = Random.Range(0, possibleNumbers.Length);
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, characters[randomValue], possibleNumbers[randomValue]);
- }
- else
- {
- FeedFluffy();
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnWrongItemUsedInScene(ItemEnum item)
- {
- int randomValue = Random.Range(0, 100);
- if (randomValue < 50)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28421");
- StartSequence(1);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28422");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28423");
- StartSequence(2);
- }
- }
- //================================================================================
- //
- //================================================================================
- private void FeedFluffy()
- {
- bool isFirstSandwich = PlayerData.Instance().RTM_IsFirstSandwich;
- PlayerData.Instance().RTM_IsCatapultReady = true;
- PlayerData.Instance().RTM_IsFluffySleeping = true;
- m_Items[(int)Items.Sandwich].gameObject.SetActive(PlayerData.Instance().GetSandwich() == ItemState.Used);
- int sequence = 0;
-
- NewSequence();
- if (PlayerData.Instance().RTM_IsFirstSandwich)
- {
- PlayerData.Instance().RTM_IsFirstSandwich = false;
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28411");
- }
- else
- {
- Characters[] characters = {
- Characters.Reader,
- Characters.Sam,
- Characters.Reader
- };
- string[] possibleNumbers = { "28411", "28412", "28413" };
- int randomValue = Random.Range(0, possibleNumbers.Length);
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, characters[randomValue], possibleNumbers[randomValue]);
- }
-
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.AnimationWithSfx,
- Characters.Fluffy,
- 4,
- m_CharacterAnimations[(int)Characters.Fluffy].AnimationCyclesString[4],
- "28410");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, FluffyAteSandwich);
- Characters[] characters2 = { Characters.Reader, Characters.Sam, Characters.Reader };
- string[] possibleNumbers2 = { "28416", "28417", "28419" };
- int randomValue2 = Random.Range(0, possibleNumbers2.Length);
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, characters2[randomValue2], possibleNumbers2[randomValue2]);
- if (isFirstSandwich)
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28420");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, UpdateOnce);
-
- StartSequence(sequence);
- }
- //================================================================================
- //
- //================================================================================
- private void FluffyAteSandwich()
- {
- //m_Items[(int)Items.Sandwich].gameObject.SetActive(false);
- if (PlayerData.Instance().RTM_IsFluffySleeping)
- ((RTM_FluffyAnimation)m_CharacterAnimations[(int)Characters.Fluffy]).PlaySleepAnimation();
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnNavigation()
- {
- if (m_CurrentInteractiveRectangle.GetActionParameter(0) == "RaingearIslandRainbow")
- {
- if (m_CurrentInteractiveRectangle.IsEnabled())
- UseCatapult();
- }
- else
- {
- base.OnNavigation();
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnBlockedNavigation()
- {
- int randomValue = Random.Range(0, 150);
- if (randomValue < 50)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28430");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28431");
- StartSequence(2);
- }
- else if (randomValue < 100)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28204");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28205");
- StartSequence(2);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "28200");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28201");
- StartSequence(2);
- }
- }
- //================================================================================
- //
- //================================================================================
- private void UseCatapult()
- {
- if (PlayerData.Instance().RTM_UsedCatapultCount < 2)
- ++PlayerData.Instance().RTM_UsedCatapultCount;
- NewSequence();
- if (PlayerData.Instance().RTM_UsedCatapultCount == 1)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "28435");
- }
- else
- {
- string[] possibleNumbers = { "28436", "28437" };
- string randomPhraseNumber = possibleNumbers[Random.Range(0, possibleNumbers.Length)];
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, randomPhraseNumber);
- }
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, HideSam);
- SetSequence(2, EventSequenceItem.EventSequenceType.Callback, HideMachine);
- SetSequence(3, EventSequenceItem.EventSequenceType.Animation,
- Characters.Reader,
- READER_CATAPULT,
- m_CharacterAnimations[(int)Characters.Reader].AnimationCyclesString[READER_CATAPULT]);
- SetSequence(4, EventSequenceItem.EventSequenceType.Callback, HideReader);
- SetSequence(5, EventSequenceItem.EventSequenceType.Callback, GotoDowntownCloudNineViaRaingearIslandRainbow);
- StartSequence(6, false);
- }
- //================================================================================
- //
- //================================================================================
- private void HideSam()
- {
- m_CharacterAnimations[(int)Characters.Sam].gameObject.SetActive(false);
- }
- //================================================================================
- //
- //================================================================================
- private void HideReader()
- {
- m_CharacterAnimations[(int)Characters.Reader].gameObject.SetActive(false);
- }
- //================================================================================
- //
- //================================================================================
- private void HideMachine()
- {
- m_CharacterAnimations[(int)Characters.RaingearThrowingMachine].gameObject.SetActive(false);
- }
- //================================================================================
- //
- //================================================================================
- void GotoDowntownCloudNineViaRaingearIslandRainbow()
- {
- // Going up the rainbow.
- PlayerData.Instance().RGIR_Direction = 1;
- KishiTechUnity.Loading.Loading.Instance().Show();
- SetCurrentToNavigation("RaingearIslandRainbow");
- base.OnNavigation();
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnCharacterAnimationCustomTimelineEvent1(CharacterAnimation character)
- {
- if (character == m_CharacterAnimations[(int)Characters.Fluffy])
- {
- m_Items[(int)Items.Bowl].gameObject.SetActive(!PlayerData.Instance().RTM_IsFluffySleeping);
- m_Items[(int)Items.Sandwich].gameObject.SetActive(false);
- }
- }
- } // public class SceneRaingearThrowingMachine : SceneCommon
- } // namespace ReaderRabbit
|