123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514 |
- //================================================================================
- //
- //================================================================================
- using UnityEngine;
- using System.Collections;
- //================================================================================
- //
- //================================================================================
- namespace ReaderRabbit
- {
- //================================================================================
- //
- //================================================================================
- public class SceneCloudNineGateway : SceneCommon
- {
- //================================================================================
- //
- //================================================================================
- private enum Characters
- {
- Reader = CharactersCommon.Reader,
- Sam = CharactersCommon.Sam,
- Paige = CharactersCommon.Paige,
- Chester = CharactersCommon.Chester,
- Gate = CharactersCommon.StartSceneSpecific,
- }
- //================================================================================
- //
- //================================================================================
- private enum Items
- {
- Bell = 0,
- }
- //================================================================================
- //
- //================================================================================
- private const int READER_BELL = (int)ReaderAnimation.AnimationCycles.Misc1 + 1;
- //================================================================================
- //
- //================================================================================
- protected override void Start()
- {
- base.Start();
- //============================================================================
- //
- //============================================================================
- int lang = PlayerPrefs.GetInt("language");
- if (lang == 0)
- m_SpeechFolder = "Resources_DA/Audio/CloudNineGateway_Speech";
- else if (lang == 1)
- m_SpeechFolder = "Resources_EN/Audio/CloudNineGateway_Speech";
- else if (lang == 2)
- m_SpeechFolder = "Resources_NO/Audio/CloudNineGateway_Speech";
- else if (lang == 3)
- m_SpeechFolder = "Resources_SP/Audio/CloudNineGateway_Speech";
- else if (lang == 4)
- m_SpeechFolder = "Resources_SW/Audio/CloudNineGateway_Speech";
- //============================================================================
- //
- //============================================================================
- PlayerData.Instance().SetVisitedCloudNineGateway(true);
- PlayerData.Instance().SetCurrentLocation(Location.CloudNineGateway);
- AudioManager.Instance().PlayBGM("BGM_CloudNineGateway");
- UpdateOnce();
- }
- //================================================================================
- //
- //================================================================================
- public override void UpdateOnce()
- {
- KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Calling SceneCloudNineGateway.UpdateOnce()...");
- if (PlayerData.Instance().IsLocationBlocked(Location.CloudNineGateway))
- {
- DisableNavigationAll();
- EnableNavigation("EdgeOfCloudNine");
- }
- else
- {
- if (PlayerData.Instance().GetBell() != ItemState.Used)
- m_Items[(int)Items.Bell].UsedInScene();
- EnableNavigationAll();
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void DoneFirstTime()
- {
- base.DoneFirstTime();
- UpdateIdleDelay();
- }
- //================================================================================
- //
- //================================================================================
- protected override void PlayFirstEvent()
- {
- if (m_IsFirstTime)
- {
- PlayFirstDialogueFlow();
- }
- else
- {
- PlayReturnDialogueFlow();
- }
- }
- //================================================================================
- //
- //================================================================================
- void PlayFirstDialogueFlow()
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12200");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12206");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12207");
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12201");
- SetSequence(4, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12202");
- SetSequence(5, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12203");
- SetSequence(6, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12204");
- SetSequence(7, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12205");
- SetSequence(8, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(9);
- }
- //================================================================================
- //
- //================================================================================
- void PlayReturnDialogueFlow()
- {
- NewSequence();
- if (PlayerData.Instance().IsLocationBlocked(Location.CloudNineGateway))
- {
- if (PlayerData.Instance().GetBell() == ItemState.None)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12250");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12251");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12252");
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12253");
- SetSequence(4, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(5);
- }
- else if (PlayerData.Instance().GetBell() == ItemState.Inventory)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12255");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12256");
- SetSequence(2, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(3);
- }
- }
- else
- {
- // Yep, use 0-150 range and discard values above 100.
- int randomValue = Random.Range(0, 150);
- if (randomValue < 50)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12260");
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(2);
- }
- else if (randomValue < 100)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12261");
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(2);
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void OnChesterOpened()
- {
- if (PlayerData.Instance().GetBell() == ItemState.Inventory)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12460");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12461");
- StartSequence(2);
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnRightItemUsedInScene(ItemEnum item)
- {
- base.OnRightItemUsedInScene(item);
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Animation,
- Characters.Reader,
- READER_BELL,
- m_CharacterAnimations[(int)Characters.Reader].AnimationCyclesString[READER_BELL]);
- SetSequence(1, EventSequenceItem.EventSequenceType.AnimationWithSfx, Characters.Gate,
- CNG_GateAnimation.AnimationCycles.Opening,
- m_CharacterAnimations[(int)Characters.Gate].AnimationCyclesString[(int)CNG_GateAnimation.AnimationCycles.Opening],
- "12151");
- SetSequence(2, EventSequenceItem.EventSequenceType.Callback, OpenGate);
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12470");
- SetSequence(4, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12471");
- StartSequence(5);
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnIdle()
- {
- KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Calling SceneCloudNineGateway.OnIdle()...");
- NewSequence();
- int randomValue = Random.Range(0, 100);
- if (randomValue < 50)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12300");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12301");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12302");
- SetSequence(3, EventSequenceItem.EventSequenceType.Callback, UpdateIdleDelay);
- StartSequence(4);
- }
- else
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12303");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12304");
- SetSequence(2, EventSequenceItem.EventSequenceType.Callback, UpdateIdleDelay);
- StartSequence(3);
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnBlockedNavigation()
- {
- KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Calling SceneCloudNineGateway.OnBlockedNavigation()...");
- NewSequence();
- int randomValue = Random.Range(0, 100);
- if (randomValue < 50)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12140");
- StartSequence(1);
- }
- else
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12141");
- StartSequence(1);
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnOtherCharacterInteraction()
- {
- KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Calling SceneCloudNineGateway.OnOtherCharacterInteraction()...");
- if (m_CurrentInteractiveRectangle.GetActionParameter(0) == "PleaseRingBellSign")
- {
- PlaySpeechPleaseRingBellSign();
- }
- else if (m_CurrentInteractiveRectangle.GetActionParameter(0) == "WelcomeSign")
- {
- PlaySpeechWelcomeSign();
- }
- }
- //================================================================================
- //
- //================================================================================
- void PlaySpeechPleaseRingBellSign()
- {
- // Play SoftClick SFX.
- AudioManager.Instance().PlaySFX("1805");
- int sequence = 0;
- NewSequence();
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12202");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12203");
- if (PlayerData.Instance().GetBell() == ItemState.None)
- {
- int randomValue = Random.Range(0, 100);
- if (randomValue < 50)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12457");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12458");
- }
- else
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12455");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12456");
- }
- }
- else if (PlayerData.Instance().GetBell() == ItemState.Inventory)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12405");
- }
- else if (PlayerData.Instance().GetBell() == ItemState.Used)
- {
- // Do nothing.
- }
- StartSequence(sequence);
- }
- //================================================================================
- //
- //================================================================================
- void PlaySpeechWelcomeSign()
- {
- // Play SoftClick SFX.
- AudioManager.Instance().PlaySFX("1805");
- int sequence = 0;
- NewSequence();
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12450");
- if (PlayerData.Instance().CNG_IsFirstClickWelcomeSign)
- {
- PlayerData.Instance().CNG_IsFirstClickWelcomeSign = false;
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12451");
- }
- StartSequence(sequence);
- }
- //================================================================================
- //
- //================================================================================
- public override void SpeechReader()
- {
- if (PlayerData.Instance().GetBell() == ItemState.None)
- {
- if (PlayerData.Instance().CNG_IsFirstClickReaderWithoutBell)
- {
- PlayerData.Instance().CNG_IsFirstClickReaderWithoutBell = false;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12400");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12401");
- StartSequence(2);
- }
- else
- {
- ReaderRandomSpeech(true);
- }
- }
- else if (PlayerData.Instance().GetBell() == ItemState.Inventory)
- {
- if (PlayerData.Instance().CNG_IsFirstClickReaderWithBell)
- {
- PlayerData.Instance().CNG_IsFirstClickReaderWithBell = false;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12405");
- StartSequence(1);
- }
- else
- {
- ReaderRandomSpeech(true);
- }
- }
- else if (PlayerData.Instance().GetBell() == ItemState.Used)
- {
- if (PlayerData.Instance().CNG_IsFirstClickReaderAfterOpeningGate)
- {
- PlayerData.Instance().CNG_IsFirstClickReaderAfterOpeningGate = false;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12410");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12411");
- StartSequence(2);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12422");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12423");
- StartSequence(2);
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void SpeechPaige()
- {
- if (PlayerData.Instance().GetBell() == ItemState.None)
- {
- if (PlayerData.Instance().CNG_IsFirstClickPaigeWithoutBell)
- {
- PlayerData.Instance().CNG_IsFirstClickPaigeWithoutBell = false;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "12350");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12351");
- StartSequence(2);
- }
- else
- {
- PaigeRandomSpeech(true);
- }
- }
- else if (PlayerData.Instance().GetBell() == ItemState.Inventory)
- {
- if (PlayerData.Instance().CNG_IsFirstClickPaigeWithBell)
- {
- PlayerData.Instance().CNG_IsFirstClickPaigeWithBell = false;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "12355");
- StartSequence(1);
- }
- else
- {
- PaigeRandomSpeech(true);
- }
- }
- else if (PlayerData.Instance().GetBell() == ItemState.Used)
- {
- if (PlayerData.Instance().CNG_IsFirstClickPaigeAfterOpeningGate)
- {
- PlayerData.Instance().CNG_IsFirstClickPaigeAfterOpeningGate = false;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "12360");
- StartSequence(1);
- }
- else
- {
- PaigeRandomSpeech(true);
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void PaigeRandomSpeech(bool ignoreSomebodySpeaking)
- {
- if (ignoreSomebodySpeaking || !IsSomebodySpeaking())
- {
- NewSequence();
- int randomValue = Random.Range(0, 100);
- if (randomValue < 50)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "12365");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12366");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "12367");
- StartSequence(3);
- }
- else
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "12368");
- StartSequence(1);
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- void OpenGate()
- {
- m_Items[(int)Items.Bell].UsedInScene();
- PlayerData.Instance().UnblockLocation(Location.CloudNineGateway);
- UpdateOnce();
- m_CharacterAnimations[(int)Characters.Gate].ChangeToIdle();
- }
- //================================================================================
- //
- //================================================================================
- public void SpeechItemBell()
- {
- // Play SoftClick SFX.
- AudioManager.Instance().PlaySFX("1805");
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "12490");
- StartSequence(1);
- }
- } // public class SceneCloudNineGateway : SceneCommon
- } // namespace ReaderRabbit
|