123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395 |
- //================================================================================
- //
- //================================================================================
- using UnityEngine;
- using System.Collections;
- using System.Collections.Generic;
- using SimpleJSON;
- //================================================================================
- //
- //================================================================================
- namespace ReaderRabbit
- {
- //================================================================================
- //
- //================================================================================
- public class SceneFlowerpotPhonics : SceneCommon
- {
- //================================================================================
- //
- //================================================================================
- private enum Characters
- {
- Reader = CharactersCommon.Reader,
- Sam = CharactersCommon.Sam,
- Paige = CharactersCommon.Paige,
- Chester = CharactersCommon.Chester,
- Bloom = CharactersCommon.StartSceneSpecific,
- }
- //================================================================================
- //
- //================================================================================
- private const int MAX_PACKAGES = 3;
- private const int MAX_CORRECT_SPEECH = 5;
- private const int MAX_INCORRECT_SPEECH = 3;
- private const int MAX_PAIGE_CLICKS = 9;
- public int word_name_speech_id;
- public int INVALID_WORD_NAME_SPEECH_ID;//word_name_speech_id - 1;
- //================================================================================
- //
- //================================================================================
- private const int WORD_LIST_1_SIZE = 20;
- private const int WORD_LIST_2_SIZE = 28;
- private const int WORD_LIST_3_SIZE = 28;
-
- private const int NUMBER_OF_MINIGAME_LEVELS = 3;
-
- [SerializeField] private VaseManager m_VaseManager;
- [SerializeField] private SolutionBox m_SolutionBox;
- [SerializeField] private CartManager m_CartManager;
- [SerializeField] private GameObject m_NewCartItemSprite;
- [SerializeField] private OldCart m_OldCartItemSprite;
- [SerializeField] private GameObject m_CartItemCollectable;
- [SerializeField] private CollectableMarble m_Marble;
-
- public FlowerpotProblemDescription m_CurrentDescription;
-
- private int m_CurrentMinigameLevel;
- private int m_CurrentWordList;
- private int m_PaigeClickCount;
- private int m_IdleIndex;
- private int m_CorrectSpeechIndex;
- private int m_IncorrectSpeechIndex;
-
- private int m_PuzzleAttempts;
- private bool m_IsFirstWagon;
- private bool m_CartItemCollectableClicked;
- // HACK: Wait for n milliseconds before processing the next click, otherwise we might
- // cancel the box animation.
- const float SOLUTION_BOX_DELAY_NEXT_CLICK = 0.1f;
- protected float m_SolutionBoxDelayForNextClick;
- [SerializeField] private Transform m_SolutionBoxInDestination;
- [SerializeField] private Transform m_SolutionBoxOutDestination;
- [SerializeField] private float m_SolutionBoxMovementSpeed = 1.0f;
- const float CART_DELAY_NEXT_CLICK = 0.1f;
- protected float m_CartDelayForNextClick;
- [SerializeField] private Transform m_CartInDestination;
- [SerializeField] private Transform m_CartOutDestination;
- [SerializeField] private Transform m_NewCartDestination;
- [SerializeField] private float m_CartMovementSpeed = 1.0f;
- [SerializeField] private BoxCollider2D m_ScreenBlocker;
- public bool isLoad;
- private int lang;
- //================================================================================
- //
- //================================================================================
- //FP.DeleteItemsGameObjects();
- protected override void Awake()
- {
- LocFP FP = GetComponent<LocFP>();
- FP.CreateItems();
- }
- protected override void Start()
- {
- base.Start();
-
- lang = PlayerPrefs.GetInt("language");
- INVALID_WORD_NAME_SPEECH_ID = word_name_speech_id - 1;
-
- if(lang == 0) m_SpeechFolder = "Resources_DA/Audio/FlowerpotPhonics_Speech";
- else if (lang == 1) m_SpeechFolder = "Resources_EN/Audio/FlowerpotPhonics_Speech";
- else if (lang == 2) m_SpeechFolder = "Resources_NO/Audio/FlowerpotPhonics_Speech";
- else if (lang == 3) m_SpeechFolder = "Resources_SP/Audio/FlowerpotPhonics_Speech";
- else if (lang == 4) m_SpeechFolder = "Resources_SW/Audio/FlowerpotPhonics_Speech";
- PlayerData.Instance().SetVisitedFlowerpotPhonics(true);
- PlayerData.Instance().SetCurrentLocation(Location.FlowerpotPhonics);
- PlayerData.Instance().UnlockActivity(Activity.FlowerpotPhonics);
- AudioManager.Instance().PlayBGM("BGM_FlowerpotPhonics");
- // ******************** TODO: REMOVE ME, I'M DEBUG CODE ********************
- //PlayerData.Instance().FP_GameState = 1;
- //m_IsFirstTime = true;
- //PlayerData.Instance().SetWagon(ItemState.None);
- //PlayerData.Instance().FP_WagonHere = false;
- // ******************** TODO: REMOVE ME, I'M DEBUG CODE ********************
- this.m_CurrentMinigameLevel = PlayerData.Instance().GetActivityLevel(Activity.FlowerpotPhonics);
- this.m_CurrentWordList = 1;
- // gameState=1 user has not heard intro
- // gameState=2 user has heard intro but has not put an item
- // into any flowerpot
- // gameState=3 user has put 1 item into a flowerpot
- // gameState=4 user has put more than 1 item into flowerpot
- if (PlayerData.Instance().FP_GameState < 1)
- PlayerData.Instance().FP_GameState = 1;
- // If user enters in state 3, change to state 2.
- if (PlayerData.Instance().FP_GameState == 3)
- PlayerData.Instance().FP_GameState = 2;
- if (PlayerData.Instance().FP_GameState > 4 || PlayerData.Instance().IsPracticeMode())
- PlayerData.Instance().FP_GameState = 4;
- Invoke("EnableInput", 0.1f);
- SetupCartState();
-
- Invoke ("ResizePrizes", 0.01f);
- m_Marble.SetParentScene(this);
- m_PaigeClickCount = 0;
- m_IdleIndex = 0;
- m_CorrectSpeechIndex = 0;
- m_IncorrectSpeechIndex = 0;
- m_PuzzleAttempts = 0;
- m_IsFirstWagon = true;
- m_CartItemCollectableClicked = false;
- }
- //================================================================================
- //
- //================================================================================
- public void EnableInput()
- {
- m_ScreenBlocker.enabled = false;
- }
- //================================================================================
- //
- //================================================================================
- public void DisableInput()
- {
- m_ScreenBlocker.enabled = true;
- }
- //================================================================================
- //
- //================================================================================
- private void ResizePrizes()
- {
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_Marble.gameObject, false);
-
- if (!m_CartItemCollectable.activeSelf)
- {
- //KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_CartItemCollectable);
- }
-
- if (!m_NewCartItemSprite.activeSelf)
- {
- KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_NewCartItemSprite);
- }
- if (!m_OldCartItemSprite.gameObject.activeSelf)
- {
- //KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ForceUpdateGameObject(m_OldCartItemSprite.gameObject);
- }
- m_SolutionBoxInDestination.position *= KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ConversionRatio;
- m_SolutionBoxOutDestination.position *= KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ConversionRatio;
- //m_SolutionBoxMovementSpeed *= KishiTechUnity.ScreenResolution.ScreenResolutionManager.Instance().ConversionRatio;
- }
- //================================================================================
- //
- //================================================================================
- private void GiveWagon()
- {
- if (!PlayerData.Instance().IsPracticeMode())
- {
- if (PlayerData.Instance().GetWagon() == ItemState.None && !PlayerData.Instance().FP_WagonHere)
- {
- /*// TODO: Play red wagon animation.
- PlayerData.Instance().FP_WagonHere = true;
- m_NewCartItemSprite.SetActive(false);
- m_CartItemCollectable.SetActive(true);
- m_OldCartItemSprite.gameObject.SetActive(true);
- m_OldCartItemSprite.HideBoxes();*/
- NewCartAnimation();
- }
- // There is no else here. GiveMarble is now called in another part of the code.
- }
- }
- //================================================================================
- //
- //================================================================================
- public void LoadNextWordSet()
- {
- TextAsset jsonText = null;
- if(lang == 0) jsonText = Resources.Load<TextAsset>("Resources_DA/FlowerpotPhonics/r1ia3");
- else if (lang == 1) jsonText = Resources.Load<TextAsset>("Resources_EN/FlowerpotPhonics/r1ia3");
- else if (lang == 2) jsonText = Resources.Load<TextAsset>("Resources_NO/FlowerpotPhonics/r1ia3");
- else if (lang == 3) jsonText = Resources.Load<TextAsset>("Resources_SP/FlowerpotPhonics/r1ia3");
- else if (lang == 4) jsonText = Resources.Load<TextAsset>("Resources_SW/FlowerpotPhonics/r1ia3");
-
- JSONNode json = JSONNode.Parse(jsonText.text);
- //int amountOfWordList = json ["DataSet"] ["Level_" + m_CurrentMinigameLevel].Count; //mycode --rafael --> use this and not the constatants in this script. This will help in localization.
- int wordListSize = GetWordListSize(m_CurrentMinigameLevel);// mycode -rafael --> original --> int wordListSize = GetWordListSize(m_CurrentMinigameLevel);
- if (m_CurrentWordList > wordListSize && !PlayerData.Instance().IsActivityLocked(Activity.FlowerpotPhonics))
- {
- m_CurrentMinigameLevel++;
-
- if (m_CurrentMinigameLevel > NUMBER_OF_MINIGAME_LEVELS)
- {
- m_CurrentMinigameLevel = NUMBER_OF_MINIGAME_LEVELS;
- }
- PlayerData.Instance().SetActivityLevel(Activity.FlowerpotPhonics, m_CurrentMinigameLevel);
-
- m_CurrentWordList = 1;
- wordListSize = GetWordListSize(m_CurrentMinigameLevel);
- }
- else if (m_CurrentWordList > wordListSize && PlayerData.Instance().IsActivityLocked(Activity.FlowerpotPhonics))
- {
- m_CurrentWordList = 0;
- }
-
- JSONNode currentLevelWordLists = json["DataSet"]["Level_"+m_CurrentMinigameLevel];
-
- m_CurrentDescription = ParseProblemDescription(currentLevelWordLists["WordList_"+m_CurrentWordList++]);
-
- m_VaseManager.SetupVases(m_CurrentDescription);
- m_SolutionBox.SetupSolutionBox(m_CurrentDescription, m_CurrentMinigameLevel < 2);
- // GiveWagon (old GiveNextPrize) is not called here anymore.
-
- //Invoke("SetupBoxes", 0.1f);
- }
- //================================================================================
- //
- //================================================================================
- private void LoadNextWordSetSpeech()
- {
- Invoke("LoadNextWordSetSpeechDelayed", 0.1f);
- }
- //================================================================================
- //
- //================================================================================
- private void LoadNextWordSetSpeechDelayed()
- {
- int sequence = 0;
- NewSequence();
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20610");
- int targetSpeechId = word_name_speech_id + m_VaseManager.GetValidWordIndex(m_CurrentDescription.SolutionItemName);
- if (targetSpeechId != INVALID_WORD_NAME_SPEECH_ID)
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, targetSpeechId.ToString());
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, SetupBoxes);
- // Play the correct speech 25% of the time, cycling through 1 of 4 lines.
- int randomValue = Random.Range(0, 200);
- if (randomValue < 50)
- {
- ++m_CorrectSpeechIndex;
- if (m_CorrectSpeechIndex >= MAX_CORRECT_SPEECH)
- m_CorrectSpeechIndex = 1;
- string[] possibleNumbers = { "20610", "20611", "20612", "20613", "20614" };
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, possibleNumbers[m_CorrectSpeechIndex]);
- }
- StartSequence(sequence);
- }
- //================================================================================
- //
- //================================================================================
- private void SetupBoxes()
- {
- m_OldCartItemSprite.HideBoxes();
- m_CartManager.SetupNextBox(m_CurrentDescription);
- }
- //================================================================================
- //
- //================================================================================
- private FlowerpotProblemDescription ParseProblemDescription(JSONNode node)
- {
- JSONNode set = node["Set_" + Random.Range(1, 3)];
- FlowerpotProblemDescription description;
-
- string[] tokenizedSet = set.ToString().Replace("\"", "").Split(' ');
-
- description = new FlowerpotProblemDescription(tokenizedSet[0], tokenizedSet[1],
- tokenizedSet[2], tokenizedSet[3], tokenizedSet[4],
- tokenizedSet[5], tokenizedSet[6], tokenizedSet[7]);
-
- return description;
- }
- //================================================================================
- //
- //================================================================================
- private int GetWordListSize(int minigameLevel)
- {
- int wordListSize = 0;
-
- if (minigameLevel == 1)
- {
- wordListSize = WORD_LIST_1_SIZE;
- }
- else if (minigameLevel == 2)
- {
- wordListSize = WORD_LIST_2_SIZE;
- }
- else
- {
- wordListSize = WORD_LIST_3_SIZE;
- }
-
- return wordListSize;
- }
- //================================================================================
- //
- //================================================================================
- private void SetupCartState()
- {
- if (PlayerData.Instance().IsPracticeMode())
- {
- m_NewCartItemSprite.SetActive(false);
- m_CartItemCollectable.SetActive(false);
- m_OldCartItemSprite.gameObject.SetActive(true);
- m_OldCartItemSprite.HideBoxes();
- }
- else
- {
- if (PlayerData.Instance().GetWagon() == ItemState.Inventory
- || PlayerData.Instance().GetWagon() == ItemState.Used)
- {
- m_NewCartItemSprite.SetActive(false);
- m_CartItemCollectable.SetActive(false);
- m_OldCartItemSprite.gameObject.SetActive(true);
- m_OldCartItemSprite.HideBoxes();
- }
- else if (PlayerData.Instance().GetWagon() == ItemState.None)
- {
- if (PlayerData.Instance().FP_WagonHere)
- {
- m_NewCartItemSprite.SetActive(false);
- m_CartItemCollectable.SetActive(true);
- m_OldCartItemSprite.gameObject.SetActive(true);
- m_OldCartItemSprite.HideBoxes();
- }
- else
- {
- m_NewCartItemSprite.SetActive(true);
- m_CartItemCollectable.SetActive(false);
- m_OldCartItemSprite.gameObject.SetActive(false);
- }
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- public VaseManager VaseManager
- {
- get { return m_VaseManager; }
- }
- //================================================================================
- //
- //================================================================================
- public SolutionBox SolutionBox
- {
- get { return m_SolutionBox; }
- }
- //================================================================================
- //
- //================================================================================
- public CartManager CartManager
- {
- get { return m_CartManager; }
- }
- //================================================================================
- //
- //================================================================================
- private void GiveMarble()
- {
- // TODO: Play kMarbleSFX and marble animation.
- m_Marble.gameObject.SetActive(true);
- m_Marble.Enable();
- }
- //================================================================================
- //
- //================================================================================
- public void GetMarble()
- {
- // Play kCOMPickUpSfxID.
- AudioManager.Instance().PlaySFX("1802");
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Callback, m_Marble.DoAction);
- StartSequence(1);
- }
- //================================================================================
- //
- //================================================================================
- protected override void PlayFirstEvent()
- {
- if (!PlayerData.Instance().IsPracticeMode())
- {
- if (m_IsFirstTime)
- {
- SpeechBloom();
- }
- else
- {
- LoadNextWordSet();
- int sequence = 0;
- NewSequence();
- if (PlayerData.Instance().FP_GameState == 1)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20500");
- }
- else
- {
- int randomValue = Random.Range(0, 150);
- if (randomValue < 50)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20550");
- }
- else if (randomValue < 100)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20551");
- }
- else
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20552");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20553");
- }
- }
- if (PlayerData.Instance().FP_GameState == 4)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20610");
- int targetSpeechId = word_name_speech_id + m_VaseManager.GetValidWordIndex(m_CurrentDescription.SolutionItemName);
- if (targetSpeechId != INVALID_WORD_NAME_SPEECH_ID)
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, targetSpeechId.ToString());
- }
- else
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20710");
- }
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, SetupBoxes);
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(sequence);
- }
- }
- else
- {
- LoadNextWordSet();
- int sequence = 0;
- NewSequence();
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20740");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20742");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20732");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20741");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20610");
- int targetSpeechId = word_name_speech_id + m_VaseManager.GetValidWordIndex(m_CurrentDescription.SolutionItemName);
- if (targetSpeechId != INVALID_WORD_NAME_SPEECH_ID)
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, targetSpeechId.ToString());
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, SetupBoxes);
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(sequence);
- }
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnNavigation()
- {
- NewSequence();
- int randomValue = Random.Range(0, 150);
- if (randomValue < 50)
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20110");
- else if (randomValue < 100)
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20111");
- else
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20112");
-
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, base.OnNavigation);
- StartSequence(2);
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnIdle()
- {
- if (PlayerData.Instance().FP_GameState > 3)
- {
- ++m_IdleIndex;
- if (m_IdleIndex > 2)
- m_IdleIndex = 1;
- NewSequence();
- if (m_IdleIndex == 1)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20675");
- StartSequence(1);
- }
- else if (m_IdleIndex == 2)
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20676");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20677");
- StartSequence(2);
- }
- }
- else
- {
- SpeechBloom();
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void SpeechReader()
- {
- int randomValue = Random.Range(0, 200);
- if (randomValue < 50)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20744");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20745");
- StartSequence(2);
- }
- else if (randomValue < 100)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20746");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20747");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20748");
- StartSequence(3);
- }
- else if (randomValue < 150)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20805");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20806");
- StartSequence(2);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20807");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20808");
- StartSequence(2);
- }
- }
- //================================================================================
- //
- //================================================================================
- public override void SpeechPaige()
- {
- string[] possibleNumbers = { "20750", "20751", "20752", "20753", "20754", "20755", "20756", "20757", "20758" };
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Paige, possibleNumbers[m_PaigeClickCount]);
- StartSequence(1);
- ++m_PaigeClickCount;
- if (m_PaigeClickCount >= MAX_PAIGE_CLICKS)
- m_PaigeClickCount = 0;
- if (m_PaigeClickCount == 4 && m_CurrentMinigameLevel != 1)
- m_PaigeClickCount = 5;
- if (m_PaigeClickCount == 5 && m_CurrentMinigameLevel == 1)
- m_PaigeClickCount = 6;
- }
- //================================================================================
- //
- //================================================================================
- public void SpeechCorrectAnswerPlaced()
- {
- // Play kCorrectSfxID (1807).
- AudioManager.Instance().PlaySFX("1807");
- string[] possibleNumbers = { "20600", "20601", "20602", "20603" };
- int sequence = 0;
- NewSequence();
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, possibleNumbers[Random.Range(0, possibleNumbers.Length)]);
- if (m_CartManager.CurrentNumberOfBoxes == MAX_PACKAGES)
- {
- string[] possibleNumbers2 = { "20605", "20606" };
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, possibleNumbers2[Random.Range(0, possibleNumbers2.Length)]);
- if (m_IsFirstWagon)
- {
- m_IsFirstWagon = false;
- // Play kRedWagonSfxID (20450).
- AudioManager.Instance().PlaySFX("20450");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20609");
- }
- else if (!PlayerData.Instance().IsPracticeMode())
- {
- if (m_Marble.IsEnabled())
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20608");
- }
- else
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20607");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, GiveMarble);
- }
- }
- }
- else
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20604");
- }
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, SolutionBoxOut);
- StartSequence(sequence);
- }
- //================================================================================
- //
- //================================================================================
- private void CorrectAnswerMoveNextOn()
- {
- //LoadNextWordSet(m_CartManager.CurrentNumberOfBoxes == MAX_PACKAGES);
- LoadNextWordSet();
- }
- //================================================================================
- //
- //================================================================================
- public void SpeechIncorrectAnswerPlaced()
- {
- // Play kWrongSfxID (1808).
- AudioManager.Instance().PlaySFX("1808");
- ++m_IncorrectSpeechIndex;
- if (m_IncorrectSpeechIndex > MAX_INCORRECT_SPEECH)
- m_IncorrectSpeechIndex = 1;
- int sequence = 0;
- NewSequence();
- if (m_IncorrectSpeechIndex == 1)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20650");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20651");
- }
- else if (m_IncorrectSpeechIndex == 2)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20652");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20653");
- }
- else
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20654");
- }
- // After the 2nd attempt, act like Paige was clicked.
- ++m_PuzzleAttempts;
- if (m_PuzzleAttempts > 2)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, CallSpeechPaige);
- }
- StartSequence(sequence);
- }
- //================================================================================
- //
- //================================================================================
- private void CallSpeechPaige()
- {
- Invoke("SpeechPaige", 0.1f);
- }
- //================================================================================
- //
- //================================================================================
- protected override void OnOtherCharacterInteraction()
- {
- SpeechBloom();
- }
- //================================================================================
- //
- //================================================================================
- private void SpeechBloom()
- {
- if (PlayerData.Instance().FP_GameState == 1)
- {
- PlayerData.Instance().FP_GameState = 2;
- SceneFirstSequencePart1();
- }
- else if (PlayerData.Instance().FP_GameState == 2)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20710");
- StartSequence(1);
- }
- else if (PlayerData.Instance().FP_GameState == 3)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20730");
- StartSequence(1);
- }
- else if (PlayerData.Instance().FP_GameState == 4)
- {
- SpeechBloomGameState4();
- }
- }
- //================================================================================
- //
- //================================================================================
- private void SceneFirstSequencePart1()
- {
- UpdateIdleDelay();
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20500");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20700");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20701");
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20702");
- SetSequence(4, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20703");
- SetSequence(5, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20704");
- SetSequence(6, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20705");
- SetSequence(7, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20706");
- SetSequence(8, EventSequenceItem.EventSequenceType.Callback, SceneFirstSequencePart2);
- StartSequence(9);
- }
- //================================================================================
- //
- //================================================================================
- private void SceneFirstSequencePart2()
- {
- UpdateIdleDelay();
- Invoke("StartSceneFirstSequencePart2", 0.1f);
- }
- //================================================================================
- //
- //================================================================================
- private void StartSceneFirstSequencePart2()
- {
- UpdateIdleDelay();
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20707");
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, ShowBagOnly);
- SetSequence(2, EventSequenceItem.EventSequenceType.Callback, SetupBoxes);
- SetSequence(3, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20708");
- SetSequence(4, EventSequenceItem.EventSequenceType.Callback, DoneFirstTime);
- StartSequence(5);
- }
- //================================================================================
- //
- //================================================================================
- private void ShowBagOnly()
- {
- // Play kPackageOpenID.
- AudioManager.Instance().PlaySFX("20451");
-
- LoadNextWordSet();
- m_SolutionBox.DisableItem();
- }
- //================================================================================
- //
- //================================================================================
- private void EnableSolutionBoxItem()
- {
- m_SolutionBox.EnableItem();
- }
- //================================================================================
- //
- //================================================================================
- private void SpeechBloomGameState4()
- {
- int randomValue = Random.Range(0, 350);
- if (randomValue < 50)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20749");
- StartSequence(1);
- }
- else if (randomValue < 100)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20740");
- StartSequence(1);
- }
- else if (randomValue < 150)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20741");
- StartSequence(1);
- }
- else if (randomValue < 200)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20742");
- StartSequence(1);
- }
- else if (randomValue < 250)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20743");
- StartSequence(1);
- }
- else if (randomValue < 300)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20744");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20745");
- StartSequence(2);
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20746");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20747");
- SetSequence(2, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20748");
- StartSequence(3);
- }
- }
- //================================================================================
- //
- //================================================================================
- public void VaseClicked(Vase.VaseType vaseType)
- {
- if (PlayerData.Instance().FP_GameState == 1)
- {
- SpeechBloom();
- }
- else
- {
- if (!m_CartManager.IsItemBeingDragged())
- {
- NewSequence();
- if (m_CurrentMinigameLevel == 1)
- {
- switch (vaseType)
- {
- case Vase.VaseType.BEGINNING_SOUND:
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20825");
- break;
- case Vase.VaseType.VOWEL_SOUND:
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20826");
- break;
- case Vase.VaseType.ENDING_SOUND:
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20827");
- break;
- }
- }
- else
- {
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20828");
- }
- StartSequence(1);
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- public void SolutionBoxClicked()
- {
- if (m_SolutionBox.IsItemEnabled())
- {
- int targetSpeechId = word_name_speech_id + m_VaseManager.GetValidWordIndex(m_CurrentDescription.SolutionItemName);
- if (targetSpeechId != INVALID_WORD_NAME_SPEECH_ID)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, targetSpeechId.ToString());
- StartSequence(1);
- }
- }
- }
- //================================================================================
- //
- //================================================================================
- public void NewCartClicked()
- {
- if (!PlayerData.Instance().FP_WagonHere && PlayerData.Instance().GetWagon() == ItemState.None)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20830");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20836");
- StartSequence(2);
- }
- }
- //================================================================================
- //
- //================================================================================
- public void OldCartClicked()
- {
- if (PlayerData.Instance().GetWagon() == ItemState.Inventory)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20832");
- StartSequence(1);
- }
- else if (PlayerData.Instance().GetWagon() == ItemState.None && PlayerData.Instance().FP_WagonHere)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20830");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20831");
- StartSequence(2);
- }
- }
- //================================================================================
- //
- //================================================================================
- public void CollectableCartClicked()
- {
- if (m_CartItemCollectableClicked)
- return;
- else
- m_CartItemCollectableClicked = true;
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20837");
- SetSequence(1, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20838");
- SetSequence(2, EventSequenceItem.EventSequenceType.Callback, CollectCart);
- StartSequence(3);
- }
- //================================================================================
- //
- //================================================================================
- private void CollectCart()
- {
- m_CartItemCollectable.SetActive(false);
- Chester.Instance().PutItem(ItemEnum.Wagon, this, this.GetChesterPosition().x, this.GetChesterPosition().y);
- PlayerData.Instance().FP_WagonHere = false;
- }
- //================================================================================
- //
- //================================================================================
- public void SpeechAnswerPickedUp(string itemName)
- {
- int targetSpeechId = word_name_speech_id + m_VaseManager.GetValidWordIndex(itemName);
- if (targetSpeechId != INVALID_WORD_NAME_SPEECH_ID)
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, targetSpeechId.ToString());
- StartSequence(1);
- }
- }
- //================================================================================
- //
- //================================================================================
- public void GrowDone(Vase.VaseType vaseType, string itemName)
- {
- int sequence = 0;
- NewSequence();
- int targetSpeechId = word_name_speech_id + m_VaseManager.GetValidWordIndex(itemName);
- if (targetSpeechId != INVALID_WORD_NAME_SPEECH_ID)
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, targetSpeechId.ToString());
- if (PlayerData.Instance().FP_GameState == 2)
- {
- PlayerData.Instance().FP_GameState = 3;
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20711");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20712");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Reader, "20713");
- if (vaseType == Vase.VaseType.BEGINNING_SOUND)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20714");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20715");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20716");
- }
- else if (vaseType == Vase.VaseType.VOWEL_SOUND)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20717");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20715");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20719");
- }
- else if (vaseType == Vase.VaseType.ENDING_SOUND)
- {
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20720");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20715");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20722");
- }
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20723");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20724");
- }
- else if (PlayerData.Instance().FP_GameState == 3)
- {
- PlayerData.Instance().FP_GameState = 4;
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, EnableSolutionBoxItem);
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20731");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20732");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20733");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20734");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Sam, "20735");
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Speech, Characters.Bloom, "20736");
- }
- StartSequence(sequence);
- }
- //================================================================================
- //
- //================================================================================
- private void SolutionBoxIn()
- {
- DisableInput();
- m_SolutionBoxDelayForNextClick = Time.time + SOLUTION_BOX_DELAY_NEXT_CLICK;
- // Run some cloud moving animation before we finally remove it from the scene.
- iTween.MoveTo(m_SolutionBox.gameObject,
- iTween.Hash(new object[] {
- "position", m_SolutionBoxInDestination,
- "time", m_SolutionBoxMovementSpeed,
- "easetype", iTween.EaseType.linear,
- "oncompletetarget", this.gameObject,
- "oncomplete", "SolutionBoxInFinished",
- "onupdatetarget", this.gameObject,
- "onupdate", "SolutionBoxInAnimationUpdate"
- }));
- }
- //================================================================================
- //
- //================================================================================
- private void SolutionBoxOut()
- {
- DisableInput();
- m_SolutionBoxDelayForNextClick = Time.time + SOLUTION_BOX_DELAY_NEXT_CLICK;
- // Run some cloud moving animation before we finally remove it from the scene.
- iTween.MoveTo(m_SolutionBox.gameObject,
- iTween.Hash(new object[] {
- "position", m_SolutionBoxOutDestination,
- "time", m_SolutionBoxMovementSpeed,
- "easetype", iTween.EaseType.linear,
- "oncompletetarget", this.gameObject,
- "oncomplete", "SolutionBoxOutFinished",
- "onupdatetarget", this.gameObject,
- "onupdate", "SolutionBoxOutAnimationUpdate"
- }));
- }
- //================================================================================
- //
- //================================================================================
- private void SolutionBoxInAnimationUpdate()
- {
- if (Input.GetMouseButtonUp(KishiTechUnity.KTInput.MouseButton.kLeft) && Time.time > m_SolutionBoxDelayForNextClick)
- {
- iTween.Stop(m_SolutionBox.gameObject);
- iTween.MoveTo(m_SolutionBox.gameObject,
- iTween.Hash(new object[] {
- "position", m_SolutionBoxInDestination,
- "time", 0.0f,
- "easetype", iTween.EaseType.linear
- }));
- SolutionBoxInFinished();
- }
- }
- //================================================================================
- //
- //================================================================================
- private void SolutionBoxOutAnimationUpdate()
- {
- if (Input.GetMouseButtonUp(KishiTechUnity.KTInput.MouseButton.kLeft) && Time.time > m_SolutionBoxDelayForNextClick)
- {
- iTween.Stop(m_SolutionBox.gameObject);
- iTween.MoveTo(m_SolutionBox.gameObject,
- iTween.Hash(new object[] {
- "position", m_SolutionBoxOutDestination,
- "time", 0.0f,
- "easetype", iTween.EaseType.linear
- }));
- SolutionBoxOutFinished();
- }
- }
- //================================================================================
- //
- //================================================================================
- private void SolutionBoxInFinished()
- {
- EnableInput();
- LoadNextWordSetSpeech();
- }
- //================================================================================
- //
- //================================================================================
- private void SolutionBoxOutFinished()
- {
- EnableInput();
- // Animate old wagon going out of screen. CartOut/In will call SolutionBoxIn later.
- if (m_CartManager.CurrentNumberOfBoxes == MAX_PACKAGES)
- {
- CartOut();
- }
- else
- {
- NewSequence();
- SetSequence(0, EventSequenceItem.EventSequenceType.Callback, CorrectAnswerMoveNextOn);
- SetSequence(1, EventSequenceItem.EventSequenceType.Callback, SolutionBoxIn);
- StartSequence(2);
- }
- }
- //================================================================================
- //
- //================================================================================
- private void CartIn()
- {
- DisableInput();
- m_CartDelayForNextClick = Time.time + CART_DELAY_NEXT_CLICK;
- iTween.MoveTo(m_OldCartItemSprite.gameObject,
- iTween.Hash(new object[] {
- "position", m_CartInDestination,
- "time", m_CartMovementSpeed,
- "easetype", iTween.EaseType.linear,
- "oncompletetarget", this.gameObject,
- "oncomplete", "CartInFinished",
- "onupdatetarget", this.gameObject,
- "onupdate", "CartInAnimationUpdate"
- }));
- }
- //================================================================================
- //
- //================================================================================
- private void CartOut()
- {
- DisableInput();
- m_CartDelayForNextClick = Time.time + CART_DELAY_NEXT_CLICK;
- // When player unloads the first wagon (new red one), the old one is not visible and must only play the CartIn animation (after playing the red cart animation).
- if (PlayerData.Instance().GetWagon() == ItemState.None && !PlayerData.Instance().FP_WagonHere && !PlayerData.Instance().IsPracticeMode())
- {
- CartOutFinished();
- m_OldCartItemSprite.transform.position = m_CartOutDestination.position;
- m_OldCartItemSprite.ShowBoxes();
- return;
- }
- iTween.MoveTo(m_OldCartItemSprite.gameObject,
- iTween.Hash(new object[] {
- "position", m_CartOutDestination,
- "time", m_CartMovementSpeed,
- "easetype", iTween.EaseType.linear,
- "oncompletetarget", this.gameObject,
- "oncomplete", "CartOutFinished",
- "onupdatetarget", this.gameObject,
- "onupdate", "CartOutAnimationUpdate"
- }));
- }
- //================================================================================
- //
- //================================================================================
- private void CartInAnimationUpdate()
- {
- if (Input.GetMouseButtonUp(KishiTechUnity.KTInput.MouseButton.kLeft) && Time.time > m_CartDelayForNextClick)
- {
- iTween.Stop(m_OldCartItemSprite.gameObject);
- iTween.MoveTo(m_OldCartItemSprite.gameObject,
- iTween.Hash(new object[] {
- "position", m_CartInDestination,
- "time", 0.0f,
- "easetype", iTween.EaseType.linear
- }));
- CartInFinished();
- }
- }
- //================================================================================
- //
- //================================================================================
- private void CartOutAnimationUpdate()
- {
- if (Input.GetMouseButtonUp(KishiTechUnity.KTInput.MouseButton.kLeft) && Time.time > m_CartDelayForNextClick)
- {
- iTween.Stop(m_OldCartItemSprite.gameObject);
- iTween.MoveTo(m_OldCartItemSprite.gameObject,
- iTween.Hash(new object[] {
- "position", m_CartOutDestination,
- "time", 0.0f,
- "easetype", iTween.EaseType.linear
- }));
- CartOutFinished();
- }
- }
- //================================================================================
- //
- //================================================================================
- private void CartInFinished()
- {
- EnableInput();
- m_CartManager.gameObject.SetActive(true);
- CorrectAnswerMoveNextOn();
- SolutionBoxIn();
- }
- //================================================================================
- //
- //================================================================================
- private void CartOutFinished()
- {
- EnableInput();
- m_OldCartItemSprite.ShowBoxes();
- int sequence = 0;
- NewSequence();
- if (!PlayerData.Instance().IsPracticeMode() && PlayerData.Instance().GetWagon() == ItemState.None && !PlayerData.Instance().FP_WagonHere)
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, NewCartAnimation);
- SetSequence(sequence++, EventSequenceItem.EventSequenceType.Callback, CartIn);
- StartSequence(sequence);
- }
- //================================================================================
- //
- //================================================================================
- private void NewCartAnimation()
- {
- DisableInput();
- m_CartDelayForNextClick = Time.time + CART_DELAY_NEXT_CLICK;
- iTween.MoveTo(m_NewCartItemSprite.gameObject,
- iTween.Hash(new object[] {
- "position", m_NewCartDestination,
- "time", m_CartMovementSpeed,
- "easetype", iTween.EaseType.linear,
- "oncompletetarget", this.gameObject,
- "oncomplete", "NewCartAnimationFinished",
- "onupdatetarget", this.gameObject,
- "onupdate", "NewCartAnimationUpdate"
- }));
- }
- //================================================================================
- //
- //================================================================================
- private void NewCartAnimationUpdate()
- {
- if (Input.GetMouseButtonUp(KishiTechUnity.KTInput.MouseButton.kLeft) && Time.time > m_CartDelayForNextClick)
- {
- iTween.Stop(m_NewCartItemSprite.gameObject);
- iTween.MoveTo(m_NewCartItemSprite.gameObject,
- iTween.Hash(new object[] {
- "position", m_NewCartDestination,
- "time", 0.0f,
- "easetype", iTween.EaseType.linear
- }));
- NewCartAnimationFinished();
- }
- }
- //================================================================================
- //
- //================================================================================
- private void NewCartAnimationFinished()
- {
- EnableInput();
- PlayerData.Instance().FP_WagonHere = true;
- m_NewCartItemSprite.SetActive(false);
- m_CartItemCollectable.SetActive(true);
- m_OldCartItemSprite.gameObject.SetActive(true);
- }
- } // public class SceneFlowerpotPhonics : SceneCommon
- } // namespace ReaderRabbit
|