//================================================================================ // //================================================================================ 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