void OnCollisionEnter2D(Collision2D col) { if (col.transform.tag == "Tori") { ato = 0; tori.DisableThisScript(); GetComponent <ColeteAllThings> ().enabled = true; tori.transform.localScale = new Vector3(1, tori.transform.localScale.y, tori.transform.localScale.z); tori.GetComponent <Atos> ().StartActionWalk(toriVelocity, toriLimitatorPosition); tori.GetComponent <Atos> ().enabled = true; } }
void OnCollisionEnter2D(Collision2D col) { if (col.transform.tag == "Tori") { ato = 0; dialogController.ChangeCameraFollowEnable(false); dialogController.ChangeLerpPosition(mainCameraPositions, mainCameraLerp); tori.DisableThisScript(); GetComponent <OperatorChefLimiter> ().enabled = true; tori.transform.localScale = new Vector3(-1, tori.transform.localScale.y, tori.transform.localScale.z); tori.GetComponent <Atos> ().StartActionWalk(toriVelocity, toriLimitatorPosition); tori.GetComponent <Atos> ().enabled = true; } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Return)) { PressedEnter(); } else if (Input.GetKeyDown(KeyCode.Escape)) { PressedEscape(); } if (timeToWait > timerCount) { switch (ato) { case 0: ato++; break; case 1: if (!tori.GetComponent <Atos> ().isActing) { tori.myComponents.myAnimator.SetTrigger("TakeFruit"); if (!tori.GetComponent <Atos> ().isActing) { for (int i = 0; i < fruits.Length; i++) { fruits [i].enabled = true; } timeToWait = 0; timerCount = 1.2f; ato++; } } break; case 2: //Wait timer over tori.transform.localScale = new Vector3(1, tori.transform.localScale.y, tori.transform.localScale.z); dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ChangeCanvasEnable(true); dialogController.ShowLine(true); ato++; break; case 4: tori.transform.localScale = new Vector3(-1f, tori.transform.localScale.y, tori.transform.localScale.z); dialogController.ChangeTargetAndEnable(suku.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 6: //Tori: Veio chato. dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 8: dialogController.ChangeTargetAndEnable(suku.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 10: dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 12: //Suku: Sei q vc quer ir conhecer a terras proibidas dialogController.ChangeTargetAndEnable(suku.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 14: dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 16: dialogController.ChangeTargetAndEnable(suku.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 18: dialogController.ChangeTargetAndEnable(suku.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 20: //Alto-falante chata Tori dialogController.altoFalante.texture = altoFalante; dialogController.ChangeTargetAndEnable(suku.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(false); ato++; break; case 22: dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 24: dialogController.ChangeTargetAndEnable(suku.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 26: dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 28: dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 30: dialogController.ChangeCameraFollowEnable(true); dialogController.ChangeCanvasEnable(false); tori.myComponents.myRigidbody2D.velocity = Vector2.zero; tori.enabled = true; Destroy(GetComponent <SukuAto> ()); break; } } else { timeToWait += Time.deltaTime; } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Return)) { PressedEnter(); } else if (Input.GetKeyDown(KeyCode.Escape)) { PressedEscape(); } if (timeToWait > timerCount) { timerCount += Time.deltaTime; return; } switch (ato) { case 0: dialogController.ChangeTargetAndEnable(fuka.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 2: dialogController.ChangeCanvasEnable(false); fuka.transform.localScale = new Vector3(fukaScaleX, fuka.transform.localScale.y, fuka.transform.localScale.z); fuka.GetComponent <Atos> ().StartActionWalk(-fukaVelocity, fukaPositions [fukaIndice]); fukaIndice++; timeToWait = 1f; timerCount = 0f; ato++; break; case 3: tori.GetComponent <Atos> ().StartActionWalk(-toriVelocity, toriPositions [toriIndice]); toriIndice++; ato++; break; case 4: if (!fuka.GetComponent <Atos> ().isActing) { fuka.transform.localScale = new Vector3(-fukaScaleX, fuka.transform.localScale.y, fuka.transform.localScale.z); dialogController.ChangeCanvasEnable(true); dialogController.ShowLine(true); ato++; } break; case 6: //Fuka começá a fuças o baú fuka.transform.localScale = new Vector3(fukaScaleX, fuka.transform.localScale.y, fuka.transform.localScale.z); dialogController.ShowLine(true); fuka.GetComponent <Components> ().myAnimator.SetTrigger("Chest"); fuka.GetComponent <Components> ().myAnimator.SetBool("ChestOver", false); ato++; break; case 8: tori.transform.localScale = new Vector3(1, tori.transform.localScale.y, tori.transform.localScale.z); dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 10: dialogController.ChangeTargetAndEnable(fuka.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); fuka.GetComponent <Components> ().myAnimator.SetBool("ChestOver", true); fuka.GetComponentInChildren <FukaAnimation> ().PlayChestOping(); fuka.GetComponent <Atos> ().StartActionWalk(-fukaVelocity, fukaPositions [fukaIndice]); fukaIndice++; chest.sprite = chests[1]; ato++; break; case 12: //Fuka reclama da falta de segurança tori.transform.localScale = new Vector3(-1, tori.transform.localScale.y, tori.transform.localScale.z); fuka.GetComponent <Components> ().myAnimator.SetTrigger("TakingInChast"); fuka.GetComponent <Components> ().myAnimator.SetBool("TakingInChastOver", false); dialogController.ShowLine(true); ato++; break; case 14: dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 16: dialogController.ChangeTargetAndEnable(fuka.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 18: fuka.transform.localScale = new Vector3(-fukaScaleX, fuka.transform.localScale.y, fuka.transform.localScale.z); fuka.GetComponent <Components> ().myAnimator.SetBool("TakingInChastOver", true); pocoes [0].enabled = true; dialogController.ShowLine(true); ato++; break; case 20: //Fuka pede para Tori seguir ele fuka.transform.localScale = new Vector3(fukaScaleX, fuka.transform.localScale.y, fuka.transform.localScale.z); dialogController.ShowLine(true); fuka.GetComponent <Atos> ().StartActionWalk(-fukaVelocity, fukaPositions [fukaIndice]); fukaIndice++; timeToWait = 1; timerCount = 0; ato++; break; case 21: tori.GetComponent <Atos> ().StartActionWalk(-toriVelocity, toriPositions [toriIndice]); toriIndice++; ato++; break; case 22: ato++; break; case 23: //A rainha da um bem vindo a Tori if (!fuka.GetComponent <Atos> ().isActing) { fuka.transform.localScale = new Vector3(-fukaScaleX, fuka.transform.localScale.y, fuka.transform.localScale.z); dialogController.ChangeTargetAndEnable(rainha); fuka.GetComponent <Components> ().myAnimator.SetTrigger("PutPocao"); StartCoroutine("PutPocao"); dialogController.ShowLine(true); ato++; } break; case 25: dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 27: dialogController.ChangeTargetAndEnable(fuka.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 29: //Tori fala q vai em bora tori.transform.localScale = new Vector3(1, tori.transform.localScale.y, tori.transform.localScale.z); dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 31: dialogController.ChangeTargetAndEnable(rainha); dialogController.ShowLine(true); ato++; break; case 33: tori.transform.localScale = new Vector3(-1, tori.transform.localScale.y, tori.transform.localScale.z); dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 35: //Fuka joga o livro dialogController.ChangeTargetAndEnable(fuka.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); fuka.GetComponent <Components> ().myAnimator.SetTrigger("ThrownBook"); StartCoroutine("ThrownBook"); ato++; break; case 37: dialogController.ShowLine(true); ato++; break; case 39: dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 41: //Mostra o redbull dialogController.ChangeCameraFollowEnable(false); dialogController.ChangeLerpPosition(badBullCameraPosition, 2f); dialogController.ChangeTargetAndEnable(rainha); dialogController.ShowLine(true); ato++; break; case 43: dialogController.ChangeCameraFollowEnable(true); dialogController.ShowLine(true); ato++; break; case 45: dialogController.ShowLine(true); ato++; break; case 47: dialogController.ShowLine(true); ato++; break; case 49: dialogController.ShowLine(true); ato++; break; case 51: dialogController.ChangeTargetAndEnable(operatorDead); dialogController.ChangeLerpPosition(operatorDead, 2); dialogController.ChangeCameraFollowEnable(false); dialogController.ShowLine(true); ato++; break; case 53: dialogController.ChangeTargetAndEnable(fuka.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ChangeCameraFollowEnable(true); dialogController.ShowLine(true); ato++; break; case 55: dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ShowLine(true); ato++; break; case 57: anciaoThatWasSpaw = Instantiate(anciao, anciaoSpaw.position, anciaoSpaw.rotation); dialogController.ChangeTargetAndEnable(anciaoThatWasSpaw.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ChangeLerpPosition(anciaoThatWasSpaw.GetComponentInChildren <CameraFacePosition> ().transform, 2); dialogController.ChangeCameraFollowEnable(false); anciaoThatWasSpaw.GetComponent <Atos> ().StartActionWalk(-2f, anciaoPosition); dialogController.ShowLine(true); ato++; break; case 59: dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); tori.transform.localScale = new Vector3(1, tori.transform.localScale.y, tori.transform.localScale.z); dialogController.ChangeCameraFollowEnable(true); dialogController.ShowLine(true); ato++; break; case 61: dialogController.ChangeTargetAndEnable(anciaoThatWasSpaw.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ChangeLerpPosition(anciaoThatWasSpaw.GetComponentInChildren <CameraFacePosition> ().transform, 2); dialogController.ChangeCameraFollowEnable(false); dialogController.ShowLine(true); ato++; break; case 63: dialogController.ShowLine(true); ato++; break; case 65: dialogController.ChangeTargetAndEnable(tori.GetComponentInChildren <CameraFacePosition> ().transform); dialogController.ChangeCameraFollowEnable(true); dialogController.ShowLine(true); ato++; break; case 67: dialogController.ChangeCameraFollowEnable(true); dialogController.ChangeCanvasEnable(false); tori.myComponents.myRigidbody2D.velocity = Vector2.zero; Destroy(anciaoThatWasSpaw.GetComponent <Atos> ()); Destroy(fuka.GetComponent <Atos> ()); anciaoThatWasSpaw.GetComponent <Rigidbody2D> ().velocity = Vector2.zero; anciaoThatWasSpaw.GetComponentInChildren <Animator> ().SetFloat("Velocity", 0); fadeOut.SetTrigger("fadeOut"); GetComponent <FukaAtos> ().enabled = false; break; } }