123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- //================================================================================
- //
- //================================================================================
- using UnityEngine;
- using System.Collections;
- //================================================================================
- //
- //================================================================================
- namespace ReaderRabbit
- {
- //================================================================================
- //
- //================================================================================
- public class SceneRaingearIsland : SceneCommon
- {
- //================================================================================
- //
- //================================================================================
- private enum Characters
- {
- Reader = CharactersCommon.Reader,
- Sam = CharactersCommon.Sam,
- Paige = CharactersCommon.Paige,
- Chester = CharactersCommon.Chester,
- RaingearThrowingMachine = CharactersCommon.StartSceneSpecific,
- }
- //================================================================================
- //
- //================================================================================
- private bool m_IsShipVideoOpening;
- private int m_ReaderClickCount;
- private const int MAX_PAIGE_INDEX = 2;
- private int m_PaigeClickCount;
- //================================================================================
- //
- //================================================================================
- protected override void Start()
- {
- base.Start();
- //============================================================================
- //
- //============================================================================
- int lang = PlayerPrefs.GetInt("language");
- if (lang == 0)
- m_SpeechFolder = "Resources_DA/Audio/RaingearIsland_Speech";
- else if (lang == 1)
- m_SpeechFolder = "Resources_EN/Audio/RaingearIsland_Speech";
- else if (lang == 2)
- m_SpeechFolder = "Resources_NO/Audio/RaingearIsland_Speech";
- else if (lang == 3)
- m_SpeechFolder = "Resources_SP/Audio/RaingearIsland_Speech";
- else if (lang == 4)
- m_SpeechFolder = "Resources_SW/Audio/RaingearIsland_Speech";
- //============================================================================
- //
- //============================================================================
- PlayerData.Instance().SetVisitedRaingearIsland(true);
- PlayerData.Instance().SetCurrentLocation(Location.RaingearIsland);
- UpdateIsVideoOpening();
- if (!m_IsShipVideoOpening)
- AudioManager.Instance().PlayBGM("BGM_RaingearIsland");
- PlayerData.Instance().DCN_VisitedRaingearIsland();
- m_ReaderClickCount = 0;
- m_PaigeClickCount = 0;
- }
- //================================================================================
- //
- //================================================================================
- private void UpdateIsVideoOpening()
- {
- m_IsShipVideoOpening = PlayerData.Instance().GetPreviousLocation() == Location.EdgeOfCloudNine;
- }
- //================================================================================
- //
- //================================================================================
- private void VideoPlayed()
- {
- m_IsShipVideoOpening = false;
- if (!AudioManager.Instance().IsPlayingBGM("BGM_RaingearIsland"))
- AudioManager.Instance().PlayBGM("BGM_RaingearIsland");
- }
- //================================================================================
- //
- //================================================================================
- protected override void DoneFirstTime()
- {
- base.DoneFirstTime();
- if (!AudioManager.Instance().IsPlayingBGM("BGM_RaingearIsland"))
- AudioManager.Instance().PlayBGM("BGM_RaingearIsland");
- }
- //================================================================================
- //
- //================================================================================
- protected override void PlayFirstEvent()
- {
- if (m_IsFirstTime)
- {
- int sequence = 0;
- NewSequence();
- if (m_IsShipVideoOpening)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Video, VideoType.GotoRaingearIsland);
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, VideoPlayed);
- }
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "24150");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "24151");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "24152");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(sequence);
- }
- else if (!PlayerData.Instance().DidVisitIrvinsHouse())
- {
- int sequence = 0;
- NewSequence();
- if (m_IsShipVideoOpening)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Video, VideoType.GotoRaingearIsland);
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, VideoPlayed);
- }
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "24200");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "24201");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(sequence);
- }
- else
- {
- int sequence = 0;
- NewSequence();
- if (m_IsShipVideoOpening)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Video, VideoType.GotoRaingearIsland);
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, VideoPlayed);
- }
- int randomValue = Random.Range(0, 100);
- if (randomValue < 50)
- {
- randomValue = Random.Range(0, 200);
- if (randomValue < 50)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "24205");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "24206");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "24207");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- }
- else if (randomValue < 100)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "24210");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- }
- else if (randomValue < 150)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "24200");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- }
- else
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "24212");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- }
- }
- StartSequence(sequence);
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnCharacterAnimationCustomTimelineEvent1(CharacterAnimation character)
- {
- if (PlayVideo.Instance().IsOpened() || m_IsShipVideoOpening)
- return;
- KishiTechUnity.KishiTechDebug.KTDebug.Instance().Log("Calling SceneCommon.OnCharacterAnimationCustomTimelineEvent1(" + character + ")...");
- if (character == m_CharacterAnimations[(int)Characters.RaingearThrowingMachine])
- {
- int randomValue = Random.Range(0, 150);
- if (randomValue < 50)
- AudioManager.Instance().PlaySFX("24002");
- else if (randomValue < 100)
- AudioManager.Instance().PlaySFX("24003");
- else
- AudioManager.Instance().PlaySFX("24004");
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnIdle()
- {
- }
- //================================================================================
- //
- //================================================================================
- public override void SpeechReader()
- {
- ++m_ReaderClickCount;
- NewSequence();
- if (m_ReaderClickCount == 1)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "24350");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "24351");
- StartSequence(2);
- }
- else if (m_ReaderClickCount == 2)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "24355");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "24356");
- StartSequence(2);
- }
- else if (m_ReaderClickCount == 3)
- {
- m_ReaderClickCount = 0;
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "24205");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "24206");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "24207");
- StartSequence(3);
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void SpeechPaige()
- {
- if (PlayerData.Instance().DidVisitIrvinsHouse())
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "2430" + (5 + m_PaigeClickCount).ToString());
- StartSequence(1);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, "24300");
- StartSequence(1);
- }
- ++m_PaigeClickCount;
- if (m_PaigeClickCount > MAX_PAIGE_INDEX)
- m_PaigeClickCount = 0;
- }
- } // public class SceneRaingearIsland : SceneCommon
- } // namespace ReaderRabbit
|