123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941 |
- //================================================================================
- //
- //================================================================================
- using UnityEngine;
- using System.Collections;
- //================================================================================
- //
- //================================================================================
- namespace ReaderRabbit
- {
- //================================================================================
- //
- //================================================================================
- public class SceneRockHead : SceneCommon
- {
- //================================================================================
- //
- //================================================================================
- private enum Characters
- {
- Reader = CharactersCommon.Reader,
- Sam = CharactersCommon.Sam,
- Paige = CharactersCommon.Paige,
- Chester = CharactersCommon.Chester,
- RockHead = CharactersCommon.StartSceneSpecific,
- ReaderUp,
- SamUp,
- PaigeUp,
- ChesterUp,
- }
- //================================================================================
- //
- //================================================================================
- private enum Items
- {
- Ladder = 0,
- Hat,
- PurpleHoop,
- PurpleHoopAtRockHead,
- }
- //================================================================================
- //
- //================================================================================
- private const int READER_FROM_RAINBOW = (int)ReaderAnimation.AnimationCycles.Misc1 + 1;
- private const int READER_UP_LADDER = READER_FROM_RAINBOW + 1;
- private const int READER_DOWN_LADDER = (int)ReaderAnimation.AnimationCycles.Misc1 + 1;
- private const int SAM_FROM_RAINBOW = (int)SamAnimation.AnimationCycles.Misc1 + 1;
- private const int SAM_UP_LADDER = SAM_FROM_RAINBOW + 1;
- private const int SAM_DOWN_LADDER = (int)SamAnimation.AnimationCycles.Misc1 + 1;
- //================================================================================
- //
- //================================================================================
- [SerializeField] private ChesterInSceneAnimation m_ChesterUpInScene;
- [SerializeField] private RRInteractiveRectangle m_ChesterUpRectangle;
- private ChesterInSceneAnimation m_OriginalChesterInScene;
- private RRInteractiveRectangle m_OriginalChesterUpRectangle;
- private bool m_IsAtBottom;
- private int m_MoreRockClicks;
- private Characters m_CurrentReaderCharacter;
- private Characters m_CurrentSamCharacter;
- private Characters m_CurrentPaigeCharacter;
- private bool m_DidEnterFromRainbow;
- //================================================================================
- //
- //================================================================================
- protected override void Start()
- {
- base.Start();
- //============================================================================
- //
- //============================================================================
- int lang = PlayerPrefs.GetInt("language");
- if (lang == 0)
- m_SpeechFolder = "Resources_DA/Audio/RockHead_Speech";
- else if (lang == 1)
- m_SpeechFolder = "Resources_EN/Audio/RockHead_Speech";
- else if (lang == 2)
- m_SpeechFolder = "Resources_NO/Audio/RockHead_Speech";
- else if (lang == 3)
- m_SpeechFolder = "Resources_SP/Audio/RockHead_Speech";
- else if (lang == 4)
- m_SpeechFolder = "Resources_SW/Audio/RockHead_Speech";
- //============================================================================
- //
- //============================================================================
- PlayerData.Instance().SetVisitedRockHead(true);
- PlayerData.Instance().SetCurrentLocation(Location.RockHead);
- AudioManager.Instance().PlayBGM("BGM_RockHead");
- // Always start at the bottom section.
- m_IsAtBottom = true;
- m_OriginalChesterInScene = m_ChesterInScene;
- m_OriginalChesterUpRectangle = m_ChesterRectangle;
- if (m_ChesterUpRectangle != null)
- m_ChesterUpRectangle.SetCallback(ProcessAction);
- int gameState = m_IsFirstTime ? 1 : PlayerData.Instance().RH_GameState;
- if (gameState == 1 && PlayerData.Instance().GetLadder() == ItemState.Inventory)
- gameState = 2;
- if (gameState < 3 && PlayerData.Instance().GetLadder() == ItemState.Used)
- gameState = 3;
- if (gameState == 3 && PlayerData.Instance().GetHoop() != ItemState.None)
- gameState = 4;
- m_MoreRockClicks = 0;
- PlayerData.Instance().RH_GameState = gameState;
- m_DidEnterFromRainbow = (PlayerData.Instance().GetPreviousLocation() == Location.NewspaperCarrierScene || PlayerData.Instance().GetPreviousLocation() == Location.RaingearIsland) && !Map.Instance().ChangedLocationFromMap;
- Map.Instance().ChangedLocationFromMap = false;
- }
- //================================================================================
- //
- //================================================================================
- private void UpdateCharacters(bool isAtBottom)
- {
- m_IsAtBottom = isAtBottom;
- for (int i = (int)Characters.Reader; i < (int)Characters.Chester; ++i)
- {
- m_CharacterAnimations[i].gameObject.SetActive(isAtBottom);
- m_CharacterRectangles[i].SetEnabled(isAtBottom);
- }
- for (int i = (int)Characters.ReaderUp; i < (int)Characters.ChesterUp; ++i)
- {
- m_CharacterAnimations[i].gameObject.SetActive(!isAtBottom);
- // We don't have Chester and RockHead in m_CharacterRectangles so subtract 2.
- m_CharacterRectangles[i - 2].SetEnabled(!isAtBottom);
- }
- m_CharacterAnimations[(int)Characters.Chester].gameObject.SetActive(isAtBottom);
- m_OriginalChesterUpRectangle.SetEnabled(isAtBottom);
- m_CharacterAnimations[(int)Characters.ChesterUp].gameObject.SetActive(!isAtBottom);
- m_ChesterUpRectangle.SetEnabled(!isAtBottom);
- if (m_IsAtBottom)
- {
- m_ChesterInScene = m_OriginalChesterInScene;
- m_ChesterRectangle = m_OriginalChesterUpRectangle;
- m_CurrentReaderCharacter = Characters.Reader;
- m_CurrentSamCharacter = Characters.Sam;
- m_CurrentPaigeCharacter = Characters.Paige;
- }
- else
- {
- m_ChesterInScene = m_ChesterUpInScene;
- m_ChesterRectangle = m_ChesterUpRectangle;
- m_CurrentReaderCharacter = Characters.ReaderUp;
- m_CurrentSamCharacter = Characters.SamUp;
- m_CurrentPaigeCharacter = Characters.PaigeUp;
- }
- Chester.Instance().SetChesterInSceneAnimation(m_ChesterInScene);
- }
- //================================================================================
- //
- //================================================================================
- private void UpdateReaderOnly()//params System.Object[] values)
- {
- //bool isAtBottom = (bool)values[0];
- m_CharacterAnimations[(int)Characters.Reader].gameObject.SetActive(m_IsAtBottom);
- m_CharacterAnimations[(int)Characters.ReaderUp].gameObject.SetActive(!m_IsAtBottom);
- }
- //================================================================================
- //
- //================================================================================
- private void UpdateHatOnly()
- {
- m_Items[(int)Items.Hat].UpdateOnce();
- }
- //================================================================================
- //
- //================================================================================
- private void UpdateItems()
- {
- for (int i = 0; i < m_Items.Length; ++i)
- m_Items[i].UpdateOnce();
- }
- //================================================================================
- //
- //================================================================================
- public override void UpdateOnce()
- {
- UpdateItems();
- UpdateCharacters(m_IsAtBottom);
- }
- //================================================================================
- //
- //================================================================================
- protected override void PlayFirstEvent()
- {
- UpdateOnce();
- //UpdateCharacters(m_IsAtBottom);
- if (m_DidEnterFromRainbow)
- EnterFromRainbow();
- else
- PlayFirstSpeech();
- }
- //================================================================================
- //
- //================================================================================
- private void EnterFromRainbow()
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.AnimationNoWait,
- m_CurrentReaderCharacter,
- READER_FROM_RAINBOW,
- m_CharacterAnimations[(int)m_CurrentReaderCharacter].AnimationCyclesString[READER_FROM_RAINBOW]);
- SetSequence(1, EventSequenceItem.EventSequenceType.Animation,
- m_CurrentSamCharacter,
- SAM_FROM_RAINBOW,
- m_CharacterAnimations[(int)m_CurrentSamCharacter].AnimationCyclesString[SAM_FROM_RAINBOW]);
- SetSequence(2, EventSequenceItem.EventSequenceType.Callback, PlayFirstSpeech);
- StartSequence(3, false);
- }
- //================================================================================
- //
- //================================================================================
- private void PlayFirstSpeech()
- {
- if (m_IsFirstTime)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21200");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21201");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21202");
- SetSequence(3, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(4);
- }
- else
- {
- if (m_DidEnterFromRainbow)
- {
- if (PlayerData.Instance().RH_IsFirstTimeFromRainbow)
- {
- PlayerData.Instance().RH_IsFirstTimeFromRainbow = false;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21250");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21251");
- SetSequence(2, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(3);
- }
- else
- {
- int randomValue = Random.Range(0, 100);
- if (randomValue < 50)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21252");
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(2);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21253");
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(2);
- }
- }
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnRightItemUsedInScene(ItemEnum item)
- {
- base.OnRightItemUsedInScene(item);
- if (item == ItemEnum.Ladder)
- {
- PlaceLadder();
- }
- else if (item == ItemEnum.Hat)
- {
- if (m_IsAtBottom == true)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21350");
- //SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21351");
- StartSequence(1);
- //O código abaixo serve para evitar o uso do chapeu antes de subir a escada.
- ItemState myState = ItemState.Inventory;
- PlayerData.Instance().SetHat(myState);
- }
- else if (PlayerData.Instance().GetLadder() == ItemState.Used)
- {
- PlaceHat();
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- private void PlaceHat()
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21520");
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, UpdateHatOnly);
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21521");
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21522");
- SetSequence(4, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21523");
- SetSequence(5, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21524");
- SetSequence(6, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21525");
- SetSequence(7, EventSequenceItem.EventSequenceType.Callback, PlayHoopSfxAndUpdateItems);
- SetSequence(8, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21526");
- StartSequence(9);
- }
- //================================================================================
- //
- //================================================================================
- private void PlayHoopSfxAndUpdateItems()
- {
- // TODO: Play kHoopPresentedID (21514) SFX.
- UpdateItems();
- ((RH_RockHeadAnimation)m_CharacterAnimations[(int)Characters.RockHead]).UpdateSpeechAnimation();
- }
- //================================================================================
- //
- //================================================================================
- private void PlaceLadder()
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21501");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentPaigeCharacter, "21502");
- SetSequence(2, EventSequenceItem.EventSequenceType.Callback, AfterPlaceLadder);
- StartSequence(3);
- }
- //================================================================================
- //
- //================================================================================
- private void AfterPlaceLadder()
- {
- PlayerData.Instance().RH_GameState = 3;
- UpdateItems();
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnWrongItemUsedInScene(ItemEnum item)
- {
- if (m_IsAtBottom)
- {
- WrongItemSpeech();
- }
- else
- {
- if (PlayerData.Instance().RH_DidTalkToRockHead)
- {
- string[] possibleNumbers = { "21530", "21531" };
- int randomValue = Random.Range(0, possibleNumbers.Length);
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, possibleNumbers[randomValue]);
- StartSequence(1);
- }
- else
- {
- WrongItemSpeech();
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- private void WrongItemSpeech()
- {
- CharactersCommon[] characters = {
- CharactersCommon.Sam,
- CharactersCommon.Reader,
- CharactersCommon.Sam,
- CharactersCommon.Reader,
- };
- string[] possibleNumbers = { "7010", "7011", "7012", "7013" };
- int randomValue = Random.Range(0, possibleNumbers.Length);
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, characters[randomValue], possibleNumbers[randomValue]);
- StartSequence(1);
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnIdle()
- {
- int maxRandom = 0;
- int index = 0;
- if (PlayerData.Instance().RH_GameState < 3)
- {
- maxRandom = 100;
- index = 1;
- }
- else
- {
- if (m_IsAtBottom)
- {
- maxRandom = 100;
- index = 2;
- }
- else
- {
- maxRandom = 150;
- index = 3;
- }
- }
- int randomValue = Random.Range(0, maxRandom);
- if (randomValue < 50)
- {
- switch (index)
- {
- case 1:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21300");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21301");
- StartSequence(2);
- break;
- case 2:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21310");
- StartSequence(1);
- break;
- case 3:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21315");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21316");
- StartSequence(2);
- break;
- }
- }
- else if (randomValue < 100)
- {
- switch (index)
- {
- case 1:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21305");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21306");
- StartSequence(2);
- break;
- case 2:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21311");
- StartSequence(1);
- break;
- case 3:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21320");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21321");
- StartSequence(2);
- break;
- }
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21325");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21326");
- StartSequence(2);
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void SpeechReader()
- {
- if (PlayerData.Instance().RH_GameState == 1)
- {
- int maxRandom = 150;
- if (PlayerData.Instance().DidVisitCloudSpellingChallenge())
- {
- maxRandom = 200;
- }
- int randomValue = Random.Range(0, maxRandom);
- if (randomValue < 50)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21450");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21451");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21452");
- StartSequence(3);
- }
- else if (randomValue < 100)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21300");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21301");
- StartSequence(2);
- }
- else if (randomValue < 150)
- {
- NewSequence();
- if (PlayerData.Instance().DidVisitCloudSpellingChallenge())
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21455");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21456");
- }
- else
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21457");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21458");
- }
- StartSequence(2);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21457");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21458");
- StartSequence(2);
- }
- }
- else if (PlayerData.Instance().RH_GameState == 2)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21351");
- StartSequence(1);
- }
- else
- {
- if (PlayerData.Instance().RH_GameState == 3 && m_IsAtBottom)
- {
- NewSequence();
- int randomValue = Random.Range(0, 100);
- if (randomValue < 50)
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21310");
- else
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21460");
- StartSequence(1);
- }
- else
- {
- RockClicked();
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void SpeechPaige()
- {
- int[] maxRandom = { 1, 2, 3, 0 };
- int randomValue = Random.Range(0, maxRandom[PlayerData.Instance().RH_GameState - 1]);
- switch (PlayerData.Instance().RH_GameState)
- {
- case 1:
- {
- string[] possibleNumbers = { "21400", "21401" };
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentPaigeCharacter, possibleNumbers[randomValue]);
- StartSequence(1);
- }
- break;
- case 2:
- {
- string[] possibleNumbers = { "21402", "21403", "21404" };
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentPaigeCharacter, possibleNumbers[randomValue]);
- StartSequence(1);
- }
- break;
- case 3:
- {
- if (PlayerData.Instance().GetHoop() == ItemState.None && PlayerData.Instance().GetHat() == ItemState.Used)
- {
- //mycode --rafael --> i coment the line below to avoid null reference. The song 21409 isnt in project.
- //NewSequence();
- //SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentPaigeCharacter, "21409");
- //StartSequence(1);
- }
- else
- {
- string[] possibleNumbers = { "21405", "21406", "21407", "21408" };
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentPaigeCharacter, possibleNumbers[randomValue]);
- StartSequence(1);
- }
- }
- break;
- case 4:
- {
- //mycode --rafael --> i coment the line below to avoid null reference. The song 21409 isnt in project.
- //NewSequence();
- //SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentPaigeCharacter, "21409");
- //StartSequence(1);
- }
- break;
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnOtherCharacterInteraction()
- {
- RockClicked();
- }
- //================================================================================
- //
- //================================================================================
- private void RockClicked()
- {
- PlayerData.Instance().RH_DidTalkToRockHead = true;
- switch (PlayerData.Instance().RH_GameState)
- {
- case 1:
- SpeechReader();
- break;
- case 2:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21350");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21351");
- StartSequence(2);
- break;
- case 3:
- if (PlayerData.Instance().GetHat() != ItemState.Used)
- {
- if (m_IsAtBottom)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21350");
- StartSequence(1);
- }
- else
- {
- int index = 1;
- ++PlayerData.Instance().RH_RockClickCount;
- if (PlayerData.Instance().RH_RockClickCount == 1)
- {
- if (PlayerData.Instance().DidVisitIrvinsHouse())
- index = 2;
- }
- else
- {
- if (m_MoreRockClicks == 1)
- {
- if (PlayerData.Instance().GetHat() == ItemState.None)
- {
- index = PlayerData.Instance().DidVisitCloudNineArtGallery() ? 4 : 3;
- }
- else
- {
- index = 5;
- }
- }
- else
- {
- if (m_MoreRockClicks > 4)
- {
- m_MoreRockClicks = 2;
- }
- index = m_MoreRockClicks + 4;
- }
- ++m_MoreRockClicks;
- }
- PlayRockHeadSpeechGameState3(index);
- }
- }
- break;
- case 4:
- if (m_IsAtBottom)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21390");
- StartSequence(1);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21391");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21392");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21393");
- StartSequence(3);
- }
- break;
- }
- }
- //================================================================================
- //
- //================================================================================
- private void PlayRockHeadSpeechGameState3(int index)
- {
- switch (index)
- {
- case 1:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21355");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21356");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21357");
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21358");
- SetSequence(4, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21359");
- SetSequence(5, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21361");
- SetSequence(6, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21362");
- SetSequence(7, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21363");
- SetSequence(8, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21364");
- StartSequence(9);
- break;
- case 2:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21355");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21356");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21357");
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21358");
- SetSequence(4, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21359");
- SetSequence(5, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21360");
- SetSequence(6, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21361");
- SetSequence(7, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21362");
- SetSequence(8, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21363");
- SetSequence(9, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21364");
- StartSequence(10);
- break;
- case 3:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21370");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21371");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21372");
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21373");
- StartSequence(4);
- break;
- case 4:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21370");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21371");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21380");
- StartSequence(3);
- break;
- case 5:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21370");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21371");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21372");
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21374");
- StartSequence(4);
- break;
- case 6:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21382");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21383");
- StartSequence(2);
- break;
- case 7:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21320");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21321");
- StartSequence(2);
- break;
- case 8:
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21385");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.RockHead, "21386");
- StartSequence(2);
- break;
- }
- }
- //================================================================================
- //
- //================================================================================
- public void LadderClicked()
- {
- DisableColliders();
- if (m_IsAtBottom)
- {
- m_IsAtBottom = false;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Animation,
- m_CurrentReaderCharacter,
- READER_UP_LADDER,
- m_CharacterAnimations[(int)m_CurrentReaderCharacter].AnimationCyclesString[READER_UP_LADDER]);
- //SetSequenceCallbackWithParameters(1, EventSequenceItem.EventSequenceType.CallbackWithParameters, UpdateReaderOnly, false);
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, UpdateReaderOnly);
- SetSequence(2, EventSequenceItem.EventSequenceType.Animation,
- m_CurrentSamCharacter,
- SAM_UP_LADDER,
- m_CharacterAnimations[(int)m_CurrentSamCharacter].AnimationCyclesString[SAM_UP_LADDER]);
- SetSequence(3, EventSequenceItem.EventSequenceType.Callback, UpdateOnce);
- SetSequence(4, EventSequenceItem.EventSequenceType.Callback, RestoreColliders);
- StartSequence(5, false);
- }
- else
- {
- m_IsAtBottom = true;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Animation,
- m_CurrentReaderCharacter,
- READER_DOWN_LADDER,
- m_CharacterAnimations[(int)m_CurrentReaderCharacter].AnimationCyclesString[READER_DOWN_LADDER]);
- //SetSequenceCallbackWithParameters(1, EventSequenceItem.EventSequenceType.CallbackWithParameters, UpdateReaderOnly, true);
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, UpdateReaderOnly);
- SetSequence(2, EventSequenceItem.EventSequenceType.Animation,
- m_CurrentSamCharacter,
- SAM_DOWN_LADDER,
- m_CharacterAnimations[(int)m_CurrentSamCharacter].AnimationCyclesString[SAM_DOWN_LADDER]);
- SetSequence(3, EventSequenceItem.EventSequenceType.Callback, UpdateOnce);
- SetSequence(4, EventSequenceItem.EventSequenceType.Callback, RestoreColliders);
- StartSequence(5, false);
- }
- }
- //================================================================================
- //
- //================================================================================
- public void HoopClicked(ItemCommon item)
- {
- if (m_IsAtBottom)
- {
- // TODO: Play WAVE_COMSOFTCLICK.
- int randomValue = Random.Range(0, 100);
- if (randomValue < 50)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21510");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, m_CurrentSamCharacter, "21511");
- StartSequence(2);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21512");
- StartSequence(1);
- }
- }
- else
- {
- if (PlayerData.Instance().GetHat() == ItemState.Used)
- {
- // TODO: Play WAVE_COMPICKUP.
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, m_CurrentReaderCharacter, "21513");
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, item.DoAction);
- SetSequence(2, EventSequenceItem.EventSequenceType.Callback, AfterGetHoop);
- StartSequence(3);
- }
- else
- {
- RockClicked();
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- private void AfterGetHoop()
- {
- PlayerData.Instance().RH_GameState = 4;
- }
- //================================================================================
- //
- //================================================================================
- public void HidePurpleHoopAtRockHead()
- {
- m_Items[(int)Items.PurpleHoopAtRockHead].gameObject.SetActive(false);
- }
- //================================================================================
- //
- //================================================================================
- public void ShowPurpleHoopAtRockHead()
- {
- m_Items[(int)Items.PurpleHoopAtRockHead].gameObject.SetActive(true);
- }
-
- } // public class SceneRockHead : SceneCommon
- } // namespace ReaderRabbit
|