123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535 |
- //================================================================================
- //
- //================================================================================
- using UnityEngine;
- using System.Collections;
- //================================================================================
- //
- //================================================================================
- namespace ReaderRabbit
- {
- //================================================================================
- //
- //================================================================================
- public class SceneNewspaperCarrierScene : SceneCommon
- {
- //================================================================================
- //
- //================================================================================
- private enum Characters
- {
- Reader = CharactersCommon.Reader,
- Sam = CharactersCommon.Sam,
- Paige = CharactersCommon.Paige,
- Chester = CharactersCommon.Chester,
- Carrie = CharactersCommon.StartSceneSpecific,
- }
- //================================================================================
- //
- //================================================================================
- private enum Items
- {
- Rubberbands = 0,
- Wagon,
- }
- //================================================================================
- //
- //================================================================================
- private const int READER_RAINBOW_ANIMATION = (int)ReaderAnimation.AnimationCycles.Misc1 + 1;
- //================================================================================
- //
- //================================================================================
- protected override void Start()
- {
- base.Start();
- //============================================================================
- //
- //============================================================================
- int lang = PlayerPrefs.GetInt("language");
- if (lang == 0)
- m_SpeechFolder = "Resources_DA/Audio/NewspaperCarrierScene_Speech";
- else if (lang == 1)
- m_SpeechFolder = "Resources_EN/Audio/NewspaperCarrierScene_Speech";
- else if (lang == 2)
- m_SpeechFolder = "Resources_NO/Audio/NewspaperCarrierScene_Speech";
- else if (lang == 3)
- m_SpeechFolder = "Resources_SP/Audio/NewspaperCarrierScene_Speech";
- else if (lang == 4)
- m_SpeechFolder = "Resources_SW/Audio/NewspaperCarrierScene_Speech";
- //============================================================================
- //
- //============================================================================
- PlayerData.Instance().SetVisitedNewspaperCarrierScene(true);
- PlayerData.Instance().SetCurrentLocation(Location.NewspaperCarrierScene);
- AudioManager.Instance().PlayBGM("BGM_NewspaperCarrierScene");
- }
- //================================================================================
- //
- //================================================================================
- public override void UpdateOnce()
- {
- m_CharacterAnimations[(int)Characters.Carrie].gameObject.SetActive(PlayerData.Instance().NCS_IsCarryInScene);
- if (PlayerData.Instance().NCS_IsCarryInScene)
- {
- m_CharacterAnimations[(int)Characters.Carrie].EnableOnlyAnimationCycle(2);
- m_CharacterAnimations[(int)Characters.Carrie].EnableAnimator();
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnNavigation()
- {
- if (m_CurrentInteractiveRectangle.GetActionParameter(0) == "RaingearIslandRainbow")
- {
- int sequence = 0;
- NewSequence();
-
- if (PlayerData.Instance().NCS_IsFirstClickRainbow)
- {
- PlayerData.Instance().NCS_IsFirstClickRainbow = false;
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17465");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17466");
- }
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, HideSam);
- SetSequence(sequence++,
- EventSequenceItem.EventSequenceType.Animation,
- Characters.Reader,
- READER_RAINBOW_ANIMATION,
- m_CharacterAnimations[(int)Characters.Reader].AnimationCyclesString[READER_RAINBOW_ANIMATION]);
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, GotoRockHeadViaRaingearIslandRainbow);
- StartSequence(sequence, false);
- }
- else
- {
- base.OnNavigation();
- }
- }
- //================================================================================
- //
- //================================================================================
- private void HideSam()
- {
- m_CharacterAnimations[(int)Characters.Sam].gameObject.SetActive(false);
- }
- //================================================================================
- //
- //================================================================================
- void GotoRockHeadViaRaingearIslandRainbow()
- {
- // Going down the rainbow.
- PlayerData.Instance().RGIR_Direction = 2;
- Map.Instance().ChangedLocationFromMap = false;
- KishiTechUnity.Loading.Loading.Instance().Show();
- SetCurrentToNavigation("RaingearIslandRainbow");
- base.OnNavigation();
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnRightItemUsedInScene(ItemEnum item)
- {
- base.OnRightItemUsedInScene(item);
- foreach (ItemCommon sceneItems in m_Items)
- sceneItems.UpdateOnce();
-
- PlayerData.Instance().NCS_IsCarryInScene = false;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17455");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17456");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17457");
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17458");
- SetSequence(4, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17459");
- StartSequence(5);
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnWrongItemUsedInScene(ItemEnum item)
- {
- if (PlayerData.Instance().NCS_IsCarryInScene)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17460");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17461");
- StartSequence(2);
- }
- else
- {
- base.OnWrongItemUsedInScene(item);
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void PlayFirstEvent()
- {
- if (m_IsFirstTime)
- {
- PlayerData.Instance().NCS_IsSecondTime = true;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17150");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17151");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17152");
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17153");
- SetSequence(4, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17154");
- SetSequence(5, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(6);
- }
- else if (!PlayerData.Instance().NCS_IsCarryInScene && PlayerData.Instance().GetRubberBand() == ItemState.None)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17210");
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(2);
- }
- else if (PlayerData.Instance().NCS_IsSecondTime)
- {
- PlayerData.Instance().NCS_IsSecondTime = false;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17200");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17201");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17202");
- SetSequence(3, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(4);
- }
- else
- {
- if (PlayerData.Instance().GetWagon() == ItemState.Inventory && PlayerData.Instance().NCS_IsFirstTimeWithWagon)
- {
- PlayerData.Instance().NCS_IsFirstTimeWithWagon = false;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17205");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17206");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17207");
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17208");
- SetSequence(4, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(5);
- }
- else if (!PlayerData.Instance().NCS_IsCarryInScene && PlayerData.Instance().GetRubberBand() == ItemState.None)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17210");
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(2);
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnIdle()
- {
- if (!IsSomebodySpeaking() && !IsPlayingSequence())
- {
- NewSequence();
- int randomValue = Random.Range(0, 150);
- if (randomValue < 50)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17250");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17251");
- SetSequence(2, EventSequenceItem.EventSequenceType.Callback, UpdateIdleDelay);
- StartSequence(3);
- }
- else if (randomValue < 100)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17252");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17253");
- SetSequence(2, EventSequenceItem.EventSequenceType.Callback, UpdateIdleDelay);
- StartSequence(3);
- }
- else
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17254");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17255");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17256");
- SetSequence(3, EventSequenceItem.EventSequenceType.Callback, UpdateIdleDelay);
- StartSequence(4);
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- public void SpeechItemRubberbands()
- {
- if (PlayerData.Instance().NCS_IsFirstClickCarry)
- {
- PlayerData.Instance().NCS_IsFirstClickCarry = false;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17300");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17301");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17302");
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17303");
- SetSequence(4, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17304");
- SetSequence(5, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17305");
- if (PlayerData.Instance().GetWagon() == ItemState.Inventory)
- SetSequence(6, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17307");
- else
- SetSequence(6, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17306");
- StartSequence(7);
- }
- else
- {
- if (PlayerData.Instance().GetWagon() == ItemState.Inventory)
- {
- PlayNewspaperGirlClickWithWagon();
- }
- else if (PlayerData.Instance().GetWagon() == ItemState.Used)
- {
- int sequence = 0;
- NewSequence();
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17450");
- if (PlayerData.Instance().NCS_IsCarryInScene)
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17451");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, m_Items[(int)Items.Rubberbands].DoAction);
- StartSequence(sequence);
- }
- else
- {
- PlayNewspaperGirlClickWithoutWagon();
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void SpeechReader()
- {
- if (!PlayerData.Instance().NCS_IsFirstClickCarry)
- {
- if (PlayerData.Instance().GetWagon() == ItemState.None)
- {
- int randomValue = Random.Range(0, 100);
- if (randomValue < 50)
- {
- PlayNewspaperGirlClickWithoutWagon();
- }
- else
- {
- ReaderRandomSpeech(true);
- }
- }
- else if (PlayerData.Instance().GetWagon() == ItemState.Used)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17409");
- StartSequence(1);
- }
- else
- {
- ReaderRandomSpeech(true);
- }
- }
- else
- {
- ReaderRandomSpeech(true);
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void ReaderRandomSpeech(bool ignoreSomebodySpeaking)
- {
- if (ignoreSomebodySpeaking || !IsSomebodySpeaking())
- {
- NewSequence();
- int maxRandom = (PlayerData.Instance().GetWagon() == ItemState.Used) ? 200 : 150;
- int randomIndex = Random.Range(0, maxRandom);
- if (randomIndex < 50)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17250");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17251");
- StartSequence(2);
- }
- else if (randomIndex < 100)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17254");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17255");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17256");
- StartSequence(3);
- }
- else if (randomIndex < 150)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17404");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17405");
- StartSequence(2);
- }
- else
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17406");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17407");
- StartSequence(2);
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void SpeechPaige()
- {
- if (PlayerData.Instance().GetWagon() == ItemState.Used)
- {
- if (PlayerData.Instance().GetRubberBand() == ItemState.None)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "17356");
- StartSequence(1);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "17357");
- StartSequence(1);
- }
- }
- else if (PlayerData.Instance().GetWagon() == ItemState.Inventory)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "17355");
- StartSequence(1);
- }
- else
- {
- PaigeRandomSpeech(true);
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void PaigeRandomSpeech(bool ignoreSomebodySpeaking)
- {
- if (ignoreSomebodySpeaking || !IsSomebodySpeaking())
- {
- NewSequence();
- int randomIndex = Random.Range(0, 100);
- if (randomIndex < 50)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "17350");
- StartSequence(1);
- }
- else
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "17351");
- StartSequence(1);
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnOtherCharacterInteraction()
- {
- if (!PlayerData.Instance().NCS_IsCarryInScene)
- return;
- if (PlayerData.Instance().GetWagon() == ItemState.Inventory)
- {
- PlayNewspaperGirlClickWithWagon();
- }
- else if (PlayerData.Instance().GetWagon() == ItemState.Used)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17320");
- StartSequence(1);
- }
- else
- {
- PlayNewspaperGirlClickWithoutWagon();
- }
- }
- //================================================================================
- //
- //================================================================================
- void PlayNewspaperGirlClickWithWagon()
- {
- NewSequence();
- int randomValue = Random.Range(0, 100);
- if (randomValue < 50)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17316");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Carrie, "17317");
- StartSequence(2);
- }
- else
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17318");
- StartSequence(1);
- }
- }
- //================================================================================
- //
- //================================================================================
- void PlayNewspaperGirlClickWithoutWagon()
- {
- int sequence = 0;
- NewSequence();
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17400");
- if (PlayerData.Instance().DidVisitFlowerpotPhonics())
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17402");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "17403");
- }
- else
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "17401");
- }
- StartSequence(sequence);
- }
- } // public class SceneNewspaperCarrierScene : SceneCommon
- } // namespace ReaderRabbit
|