// Update is called once per frame void Update() { if (mQuizReception.GetItems().Count > 0) { //mEnding.FinishOneLine(); mQuizReception.GetItems().Clear(); } }
// Update is called once per frame void Update() { if (quizReception.GetItems().Count > 0) { //cntReceived++; itemsBox.MoveItemIn(quizReception.GetItems()[0]); quizReception.RemoveItem(quizReception.GetItems()[0]); } }
// Update is called once per frame void Update() { foreach (var buttom in mBtns) { foreach (var it in mQuizReception.GetItems()) { if (it.name.ToLower().IndexOf(buttom.name) >= 0) { mCurrSp = mBtnVSSp[buttom]; mSpR.sprite = mCurrSp; } } } // TODO // resolve this memory leak mQuizReception.GetItems().Clear(); }
// Start is called before the first frame update void Start() { End.SetActive(false); isResolved = false; quizReception = this.GetComponent <QuizReception>(); itBk = new List <GameObject>(quizReception.GetItems().ToArray()); this.GetComponent <SpriteRenderer>().sprite = mSpArea[mPhase]; for (int i = 0; i < mAnsNameOrder.Count; i++) { mNameVSPic.Add(mAnsNameOrder[i], mSpAdd[i]); } }
// Update is called once per frame void Update() { if (isSolved) { return; } var invenotory = mQuizReception.GetItems(); Debug.Assert(invenotory.Count <= mAnsCnt); List <GameObject> pieceToRemove = new List <GameObject>(); foreach (var piece in invenotory) { if (Vector3.Distance(piece.transform.position, mAnsPositions[piece.name.Replace("(Clone)", "").Trim()]) < mShortDistance) { //piece.GetComponent<QuizPuzzlePiece>().freeze = true; //piece.transform.position = mAnsPositions[piece.name.Replace("(Clone)", "").Trim()]; //mStillNeedCnt -= 1; //pieceToRemove.Add(piece); } } //foreach(var obj in pieceToRemove) //{ // invenotory.Remove(obj); //} var cnt = 0; foreach (var piece in invenotory) { if (Vector3.Distance(piece.transform.position, mAnsPositions[piece.name.Replace("(Clone)", "").Trim()]) < mShortDistance) { cnt++; } } if (cnt == mAnsCnt) { foreach (var piece in invenotory) { piece.GetComponent <QuizPuzzlePiece>().freeze = true; piece.transform.position = mAnsPositions[piece.name.Replace("(Clone)", "").Trim()]; } mEnding.FinishOneLine(); isSolved = true; if (mBonus != null) { FindObjectOfType <ItemsBox>().MoveItemIn(mBonus); mBonus = null; } //this.mSceneObj.GetComponent<SceneObj>().QuizResolved(); } }
// Update is called once per frame void Update() { var inventory = quizReception.GetItems(); // first a coin if (cntReceived == 0 && inventory.Count > 0) { cntReceived++; itemsBox.MoveItemIn(mPieceBonus); quizReception.GetRefuse().Add(inventory[0]); quizReception.RemoveItem(inventory[0]); } else if (inventory.Count > 0) { itemsBox.MoveItemIn(inventory[0]); quizReception.RemoveItem(inventory[0]); } }
// Update is called once per frame void Update() { var inventory = quizReception.GetItems(); if (cntReceived < 2 && inventory.Count > 0) { if (inventory[0].name.IndexOf("Coin") > 0) { cntReceived++; if (mPieceBonus != null) { itemsBox.MoveItemIn(mPieceBonus); } quizReception.GetRefuse().Add(inventory[0]); inventory.Clear(); } else if (inventory[0].name.IndexOf("Booze") > 0) { mShowName[0].SetActive(false); mShowName[1].SetActive(true); cntReceived++; itemsBox.MoveItemIn(mAgreementBonus); quizReception.GetRefuse().Add(inventory[0]); inventory.Clear(); } else { itemsBox.MoveItemIn(inventory[0]); inventory.Clear(); } } if (cntReceived >= 2 && inventory.Count > 0) { itemsBox.MoveItemIn(inventory[0]); inventory.Clear(); } }
// Update is called once per frame void Update() { if (mStRed == STATE.CAN_GIVE || mStGreen == STATE.CAN_GIVE) { if (mStGreen == STATE.CAN_GIVE && Common.Utils.ClickedOn(this.gameObject)) { mStGreen = STATE.GAVE; this.GetComponent <SpriteRenderer>().sprite = mSpVide; mItemsBox.MoveItemIn(mLiguidGreen); } if (mStRed == STATE.CAN_GIVE && Common.Utils.ClickedOn(this.gameObject)) { mStRed = STATE.GAVE; this.GetComponent <SpriteRenderer>().sprite = mSpVide; mItemsBox.MoveItemIn(mLiguidRed); } return; } foreach (var it in mQuizReception.GetItems()) { if (mStGreen == STATE.HAS && Common.Utils.TrimClone(it.name) == mLiguidGreen.name) { mStGreen = STATE.CAN_GIVE; this.GetComponent <SpriteRenderer>().sprite = mSpGreen; mQuizReception.RemoveItem(it); return; } if (mStRed == STATE.HAS && Common.Utils.TrimClone(it.name) == mLiguidRed.name) { mStRed = STATE.CAN_GIVE; this.GetComponent <SpriteRenderer>().sprite = mSpRed; mQuizReception.RemoveItem(it); return; } } }
// Update is called once per frame void Update() { if (isResolved) { End.SetActive(true); Common.Utils.SetActive(false); if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } return; } var its = quizReception.GetItems(); if (mPhase == mSpArea.Count) { int i; for (i = 0; i < its.Count; i++) { if (mNowOrd[i].name.IndexOf(mAnsNameOrder[i]) < 0) { break; } } if (i != its.Count) { foreach (var obj in its) { FindObjectOfType <ItemsBox>().MoveItemIn(obj); } its.Clear(); //StartCoroutine(DelaySeconds(mTimeDelay)); mPhase = 0; mNowOrd.Clear(); itBk = new List <GameObject>(quizReception.GetItems().ToArray()); mObjAdd.GetComponent <SpriteRenderer>().sprite = null; this.GetComponent <SpriteRenderer>().sprite = mSpArea[mPhase]; Common.Utils.SetActiveLayer("Default"); Common.Utils.SetActive(true); this.transform.parent.gameObject.SetActive(false); return; } else { isResolved = true; return; } } //this.GetComponent<SpriteRenderer>().sprite = mSpArea[mPhase]; if (its.Count != itBk.Count) { GameObject newObj = null; string name = ""; foreach (var obj in its) { if (!itBk.Contains(obj)) { newObj = obj; break; } } foreach (var s in mAnsNameOrder) { if (newObj.name.IndexOf(s) > 0) { name = s; } } mNowOrd.Add(newObj); mObjAdd.GetComponent <SpriteRenderer>().sprite = mNameVSPic[name]; StartCoroutine(DelaySeconds(mTimeDelay)); mPhase++; } itBk = new List <GameObject>(quizReception.GetItems().ToArray()); }
// Update is called once per frame void Update() { if (mResolved) { return; } foreach (var buttun in mButtomsVSSprite) { buttun.Key.SetActive(false); } foreach (var buttom in mButtomsVSSprite) { foreach (var fake in mQuizReception.GetItems()) { if (buttom.Key.name == Common.Utils.TrimClone(fake.name)) { var newBand = Instantiate(mBandPrefab); newBand.GetComponent <SpriteRenderer>().sprite = buttom.Value; newBand.transform.parent = this.transform; newBand.transform.localPosition = mCurrPosition; newBand.transform.name = buttom.Key.name; mCurrPosition += (Vector3)(Vector2.up * buttom.Value.textureRect.height / buttom.Value.pixelsPerUnit * 2); mBottleBandsKeeper.Add(newBand); Destroy(fake); } //if (buttun.Key.name == Common.Utils.TrimClone(fake.name)) //{ // buttun.Key.SetActive(true); //} } } mQuizReception.GetItems().Clear(); if (Common.Utils.ClickedOn(mButtomFlush)) { foreach (var band in mBottleBandsKeeper) { Destroy(band.gameObject); } mCurrPosition = mButtun; mBottleBandsKeeper.Clear(); } foreach (var buttom in mButtomsVSSprite) { if (Common.Utils.ClickedOn(buttom.Key)) { //var newBand = Instantiate(mBandPrefab); //newBand.GetComponent<SpriteRenderer>().sprite = buttom.Value; //newBand.transform.parent = this.transform; //newBand.transform.localPosition = mCurrPosition; //newBand.transform.name = buttom.Key.name; //mCurrPosition += (Vector3)(Vector2.up * buttom.Value.textureRect.height // / buttom.Value.pixelsPerUnit); //mBottleBandsKeeper.Add(newBand); } } if (mBottleBandsKeeper.Count > mAnsOrder.Count) { foreach (var band in mBottleBandsKeeper) { Destroy(band.gameObject); } mCurrPosition = mButtun; mBottleBandsKeeper.Clear(); } else if (mBottleBandsKeeper.Count == mAnsOrder.Count) { int i = 0; for (i = 0; i < mBottleBandsKeeper.Count; i++) { if (mBottleBandsKeeper[i].name != mAnsOrder[i].name) { break; } } if (i == mBottleBandsKeeper.Count) { mResolved = true; FindObjectOfType <ItemsBox>().MoveItemIn(mItemBeer); //mSceneObj.GetComponent<SceneObj>().QuizResolved(); } } }
// Update is called once per frame void Update() { // don't render then, just for knowing them received var invenotory = mQuizReception.GetItems(); if (Common.Utils.ClickedOnChildenOf(this.gameObject)) { var talkedCnt = 0; foreach (var tgt in mNPCs) { if (tgt.talked && !tgt.isActive) { talkedCnt++; } } if (talkedCnt == 4) { mBigMsg.SetActive(true); } } foreach (var obj in invenotory) { obj.SetActive(false); foreach (var tgt in mNPCs) { if (Common.Utils.TrimClone(obj.name) == tgt.obj.name) { foreach (var _tgt in mNPCs) { _tgt.isActive = true; mBigMsg.SetActive(false); } //tgt.isActive = true; } } } foreach (var tgt in mNPCs) { if (Common.Utils.ClickedOn(tgt.obj)) { if (!tgt.isActive) // initial state { if (!tgt.msg.activeSelf) { ShowMsg(tgt.msg, mShowMsgTime); tgt.talked = true; } //ShowMsg(tgt.msg, mShowMsgTime); //tgt.talked = true; } else // state 2 { //ShowMsg(tgt.msg, mShowMsgTime); if (mPictureHold == null) { if (tgt.musicSign.activeSelf) { foreach (var clr in mNPCs) { clr.musicSign.SetActive(false); } mNowOrder = ""; } else { tgt.musicSign.SetActive(true); mNowOrder += tgt.num; } } } } } foreach (var tgt in mNPCs) { if (tgt.isActive && mPictureHold != null) { mBigMsg2.SetActive(true); } } if (mNowOrder == mAnsOrder && tmpLayer == -1) { tmpLayer = Common.Utils.GetActiveLayer(); Common.Utils.SetActive(false); Ending(); } }