public void GiveBackControls() { rpgTalk.shouldStayOnScreen = false; controls = true; StartCoroutine(holUpAHotSecond()); rpgTalk.EndTalk(); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Return)) { rpgTalk.EndTalk(); } //if the player hits E, check if it is talking with someone if (Input.GetKeyDown(KeyCode.E)) { if (touching == "NPC") { controls = false; rpgTalk.lineToStart = 15; rpgTalk.lineToBreak = 16; rpgTalk.callbackFunction = "WhoAreYou"; rpgTalk.NewTalk(); } if (touching == "Girl") { controls = false; rpgTalk.lineToStart = 33; rpgTalk.lineToBreak = -1; rpgTalk.callbackFunction = "GiveBackControls"; rpgTalk.shouldStayOnScreen = true; rpgTalk.NewTalk(); } } }
// Update is called once per frame void Update() { //skip the Talk to the end if the player hit Return if (Input.GetKeyDown(KeyCode.Return)) { rpgTalk.EndTalk(); } //if the user have the controls if (controls) { //let's move around! float moveX = Input.GetAxis("Horizontal"); float moveY = Input.GetAxis("Vertical"); rigid.MovePosition(new Vector2(transform.position.x + moveX * speed, transform.position.y + moveY * speed)); //Not the best way to do it but... change the animator if (moveX > 0) { anim.SetBool("side", true); anim.SetBool("top", false); anim.SetBool("bottom", false); render.flipX = true; anim.speed = 1; } else if (moveX < 0) { anim.SetBool("side", true); anim.SetBool("top", false); anim.SetBool("bottom", false); render.flipX = false; anim.speed = 1; } else if (moveY < 0) { anim.SetBool("side", false); anim.SetBool("top", false); anim.SetBool("bottom", true); anim.speed = 1; } else if (moveY > 0) { anim.SetBool("side", false); anim.SetBool("top", true); anim.SetBool("bottom", false); anim.speed = 1; } else { anim.speed = 0; } } else { anim.speed = 0; } }
// Update is called once per frame void Update() { //skip the Talk to the end if the player hit Return if (Input.GetKeyDown(KeyCode.Return)) { rpgTalk.EndTalk(); } }
// Update is called once per frame void FixedUpdate() { //skip the Talk to the end if(Input.GetKeyDown(KeyCode.Return)){ rpgTalk.EndTalk (); } if (controls) { //Vector2 movement_vector = new Vector2 (Input.GetAxis ("Horizontal"), Input.GetAxis ("Vertical")); Vector2 movement_vector = new Vector2 (CrossPlatformInputManager.GetAxis("Horizontal"),CrossPlatformInputManager.GetAxis("Vertical")); if (movement_vector != Vector2.zero) { anim.SetBool ("iswalking", true); anim.SetFloat ("inputx", movement_vector.x); anim.SetFloat ("inputy", movement_vector.y); } else { anim.SetBool ("iswalking", false); } if (Input.GetKey (KeyCode.LeftShift )|| BoostCheck){ speed = 2; anim.speed = 2; } else { speed = 1; anim.speed = 1; } Debug.Log(speed+" Speedde "+anim.speed); rbody.MovePosition (rbody.position + movement_vector * speed * Time.deltaTime); if (Input.GetKeyDown (KeyCode.E) || TalkCheck ) { if (touching == "FunnyGuy") { controls = false; rpgTalk.lineToStart = 49; rpgTalk.lineToBreak = 53; rpgTalk.callbackFunction = "WhoAreYou"; rpgTalk.NewTalk (); } if (touching == "Molly") { controls = false; rpgTalk.lineToStart = 36; rpgTalk.lineToBreak = 39; rpgTalk.callbackFunction = "ByeWall"; rpgTalk.callbackFunction = "GiveBackControls"; rpgTalk.shouldStayOnScreen = false; rpgTalk.NewTalk (); } } } else { anim.speed = 0; } }
void ActuallySkip() { delaying = false; if (timeline != null) { timeline.Skip(jumpQuestions); } else { rpgtalk.EndTalk(jumpQuestions); } }
void ReturnDefaults() { m_TrackBinding.txtToParse = m_txtToParse; m_TrackBinding.lineToBreak = m_lineToBreak; m_TrackBinding.lineToStart = m_lineToStart; m_TrackBinding.textSpeed = m_textSpeed; m_TrackBinding.enableQuickSkip = m_enableQuickSkip; m_TrackBinding.enablePass = m_enablePass; m_FirstFrameHappened = false; m_TrackBinding.EndTalk(); m_TrackBinding.OnEndTalk -= OnEndTalk; rpgTime = null; }
//public UnityEvent sceneOneEnd, sceneTwoEnd, finalSceneEnd; // References // Update is called once per frame void Update() { // Skip the Talk to the end if the player hits Y if (Input.GetKeyDown(KeyCode.Y)) { rpgTalk.EndTalk(); } if (controls) { movement.x = Input.GetAxisRaw("Horizontal"); movement.y = Input.GetAxisRaw("Vertical"); movement = movement.normalized; if (Input.GetAxisRaw("Horizontal") != 0 || Input.GetAxisRaw("Vertical") != 0) { animator.SetFloat("Horizontal", movement.x); animator.SetFloat("Vertical", movement.y); } animator.SetFloat("Speed", movement.sqrMagnitude); } }
void OnMadeChoice(int questionID, int choiceNumber) { if (questionID == 1) { if (choiceNumber == 0) { if (rpgVill.isPlaying == false) { GameObject.FindWithTag("Player").GetComponent <PlayerMovement> ().CanMove = false; rpgVill.NewTalk("5", "7"); lastPressed = 0.0f; } } else if (choiceNumber == 1) { if (rpgVill.isPlaying == false) { lastPressed = 0.0f; rpgVill.EndTalk(); } } } }
// Update is called once per frame void Update() { if (Input.GetKeyDown("space")) { GameObject.Find("pressSpace").GetComponent <Text>().enabled = false; } if (Input.GetMouseButton(0)) { GameObject.Find("pressLeftClick").GetComponent <Text>().enabled = false; } //if (mainCam.GetComponent<randomSpawner>().killStreak > -1) //{ // if(colorIsChanging == false) // { // StartCoroutine(killStreakColorShift()); // } //} LineRenderer lineRenderer = GetComponent <LineRenderer>(); if (!hasAimItem && GetComponent <fireBullet>().canShoot == true && inTown != true) { lineRenderer.positionCount = 2; lineRenderer.SetPosition(0, myPos); lineRenderer.SetPosition(1, target); } if (hasAimItem) { Vector3 fwd = transform.TransformDirection(Vector3.forward); RaycastHit2D hit = Physics2D.Raycast(transform.position, target - (Vector2)transform.position, 20, 1 << LayerMask.NameToLayer("Default")); RaycastHit2D hitEnemy = Physics2D.Raycast(transform.position, target - (Vector2)transform.position, 20, 1 << LayerMask.NameToLayer("Enemy"), 2 << LayerMask.NameToLayer("RedEnemy")); //Debug.DrawRay(transform.position, target - (Vector2)transform.position, Color.green); if (hitEnemy) { lineRenderer.positionCount = 2; lineRenderer.SetPosition(0, transform.position); lineRenderer.SetPosition(1, hitEnemy.point); } else if (hit) { lineRenderer.positionCount = 2; lineRenderer.enabled = true; lineRenderer.SetPosition(0, transform.position); lineRenderer.SetPosition(1, hit.point); Vector2 dir = Vector2.Reflect((hit.point - (Vector2)transform.position), hit.normal); RaycastHit2D hitTwo = Physics2D.Raycast(hit.point + dir * .01f, dir, 20, 1 << LayerMask.NameToLayer("Default")); RaycastHit2D hitEnemyTwo = Physics2D.Raycast(hit.point + dir * .01f, dir, 20, 1 << LayerMask.NameToLayer("Enemy"), 2 << LayerMask.NameToLayer("RedEnemy")); Debug.DrawRay(hit.point + dir * .01f, dir, Color.green); if (hitEnemyTwo) { lineRenderer.positionCount = 3; lineRenderer.SetPosition(0, transform.position); lineRenderer.SetPosition(1, hit.point); lineRenderer.SetPosition(2, hitEnemyTwo.point); } else if (hitTwo.collider != null) { lineRenderer.positionCount = 3; lineRenderer.SetPosition(0, transform.position); lineRenderer.SetPosition(1, hit.point); lineRenderer.SetPosition(2, hitTwo.point); } else { lineRenderer.positionCount = 2; } } else { lineRenderer.enabled = false; } } if (GetComponent <fireBullet>().notInAOE == false) { lineRenderer.enabled = false; } else { lineRenderer.enabled = true; } if (GetComponent <fireBullet>().canShoot == false) { lineRenderer.positionCount = 0; } if (playerHP > maxPlayerHP) { playerHP = maxPlayerHP; GameObject.FindGameObjectWithTag("Score").GetComponent <TextMesh>().text = "HP: " + playerHP; } if (GetComponent <fireBullet>().notInAOE == false) { characterSpeed = 1f; GetComponent <SpriteRenderer>().color = new Color(255, 255, 0); } else { if (colorIsChanging == false) { GetComponent <SpriteRenderer>().color = new Color(1, 1, 1); } characterSpeed = 1.5f; } greenBullets = GameObject.FindGameObjectsWithTag("Bullet"); target = Camera.main.ScreenToWorldPoint(new Vector2(Input.mousePosition.x, Input.mousePosition.y)); myPos = new Vector2(transform.position.x, transform.position.y); direction = target - myPos; direction.Normalize(); if (playerHP <= 0) { characterSpeed = 0; GetComponent <fireBullet>().canShoot = false; StartCoroutine(ReloadScene()); GetComponent <Collider2D>().isTrigger = true; GetComponent <Transform>().position = new Vector3(GetComponent <Transform>().position.x, GetComponent <Transform>().position.y, -8); } //character movement if (controls == true) { //up //if (Input.GetKey(MoveUp) && playerHP > 0) //{ // gameObject.transform.Translate(new Vector2(0, 0.03f) * characterSpeed * Time.deltaTime * 100); // //gameObject.GetComponent<Animator>().SetBool("isWalking", true); // changeState(prismUp); //} ////else ////{ //// gameObject.GetComponent<Animator>().SetBool("isWalking", false); ////} ////down //if (Input.GetKey(MoveDown) && playerHP > 0) //{ // gameObject.transform.Translate(new Vector2(0, -0.03f) * characterSpeed * Time.deltaTime * 100); // //gameObject.GetComponent<Animator>().SetBool("isWalking", true); // changeState(prismIdle); //} ////else ////{ //// gameObject.GetComponent<Animator>().SetBool("isWalking", false); ////} ////right //if (Input.GetKey(MoveRight) && playerHP > 0) //{ // gameObject.transform.Translate(new Vector2(0.03f, 0f) * characterSpeed * Time.deltaTime * 100); // changeState(prismRight); // //gameObject.GetComponent<Animator>().SetBool("isWalking", true); // //gameObject.GetComponent<SpriteRenderer>().flipX = true; //} ////else ////{ //// gameObject.GetComponent<Animator>().SetBool("isWalking", false); ////} ////left //if (Input.GetKey(MoveLeft) && playerHP > 0) //{ // gameObject.transform.Translate(new Vector2(-0.03f, 0f) * characterSpeed * Time.deltaTime * 100); // changeState(prismLeft); // //gameObject.GetComponent<Animator>().SetBool("isWalking", true); // //gameObject.GetComponent<SpriteRenderer>().flipX = false; //} //else //{ // gameObject.GetComponent<Animator>().SetBool("isWalking", false); //} if (Input.GetKey(Replay)) { Application.LoadLevel("PRISM"); } if (Input.GetKey(Replay) && Input.GetKey(deleteNPC)) { PlayerPrefs.DeleteKey("NPCsTalkedTo"); Application.LoadLevel("PRISM"); } if (camera.GetComponent <randomSpawner>().enemiesRemaining == 0 && inTown == false) { if (Input.GetKeyDown("space")) { if (touching == "NPC(Clone)") { townButton.SetActive(false); eatButton.SetActive(false); controls = false; rpgTalk.lineToStart = 1; rpgTalk.lineToBreak = 2; rpgTalk.NewTalk(); rpgTalk.shouldStayOnScreen = true; rpgTalk.callbackFunction = "NPCChoice"; } } } if (camera.GetComponent <randomSpawner>().enemiesRemaining > 0) { if (touching == "NPC(Clone)") { rpgTalkToFollow.lineToStart = 1; rpgTalkToFollow.lineToBreak = 1; rpgTalkToFollow.NewTalk(); } if (touching == "") { rpgTalkToFollow.EndTalk(); } } if (camera.GetComponent <randomSpawner>().enemiesRemaining <= 0) { rpgTalkToFollow.EndTalk(); } } }
void FixedUpdate() { Vector3 mov = new Vector3(0, 0); bool noAnim = true; if (animator != null) { GetComponent <AudioSource>().Pause(); animator.SetBool("moveUp", false); animator.SetBool("moveDown", false); animator.SetBool("moveLeft", false); animator.SetBool("moveRight", false); animator.SetBool("attack", false); } if (controls.key(controls.Forward)) { mov += Vector3.forward; if (animator != null && noAnim) { GetComponent <AudioSource>().UnPause(); noAnim = false; animator.SetBool("moveUp", true); } } if (controls.key(controls.Backward)) { mov += Vector3.back; if (animator != null && noAnim) { noAnim = false; GetComponent <AudioSource>().UnPause(); animator.SetBool("moveDown", true); } } if (controls.key(controls.Left)) { mov += Vector3.left; if (animator != null && noAnim) { noAnim = false; GetComponent <AudioSource>().UnPause(); animator.SetBool("moveLeft", true); } } if (controls.key(controls.Right)) { mov += Vector3.right; if (animator != null && noAnim) { noAnim = false; GetComponent <AudioSource>().UnPause(); animator.SetBool("moveRight", true); } } if (Input.GetKey(KeyCode.F)) { if (animator != null && noAnim) { noAnim = false; animator.SetBool("attack", true); } } if (mov != Vector3.zero) { rpgtalk.EndTalk(true); } mov.Normalize(); transform.Translate(mov * speed); //cam.transform.Translate(mov * speed); GetComponentInChildren <actionManagerPlayerRotation>().setRotation(mov); }
// Update is called once per frame void Update() { //customer selected if (InitiateTalk && LevelManager.LvMg.canTalk) { if (RideCus01) { Cus1TalkCount = PlayerPrefs.GetInt("C1TC_Temp"); //initial = 1; if (Cus1TalkCount == 5) { SoundManager.soundMg.bgm_source.Stop(); rpgTalk.NewTalk("Customer1_Talk5_START", "Cus1Talk5_CutScene1Start", rpgTalk.txtToParse, this, "Cus1Talk5CutScene1"); } else { rpgTalk.NewTalk("Customer1_Talk" + Cus1TalkCount.ToString() + "_START", "Customer1_Talk" + Cus1TalkCount.ToString() + "_END", rpgTalk.txtToParse, this, "AfterCusTalk"); } InitiateTalk = false; } if (RideCus02) { Cus2TalkCount = PlayerPrefs.GetInt("C2TC_Temp"); //initial = 1; if (Cus2TalkCount == 5) { SoundManager.soundMg.bgm_source.Stop(); rpgTalk.NewTalk("Customer2_Talk5_START", "Cus2Talk5_CutScene1Start", rpgTalk.txtToParse, this, "Cus2Talk5CutScene1"); } else { rpgTalk.NewTalk("Customer2_Talk" + Cus2TalkCount.ToString() + "_START", "Customer2_Talk" + Cus2TalkCount.ToString() + "_END", rpgTalk.txtToParse, this, "AfterCusTalk"); } InitiateTalk = false; } if (RideCus03) { Cus3TalkCount = PlayerPrefs.GetInt("C3TC_Temp"); //initial = 1; if (Cus3TalkCount == 5) { SoundManager.soundMg.bgm_source.Stop(); rpgTalk.NewTalk("Customer3_Talk5_START", "Customer3_Talk5_END", rpgTalk.txtToParse, this, "Cus3Talk5CutScene1"); } else { rpgTalk.NewTalk("Customer3_Talk" + Cus3TalkCount.ToString() + "_START", "Customer3_Talk" + Cus3TalkCount.ToString() + "_END", rpgTalk.txtToParse, this, "AfterCusTalk"); } InitiateTalk = false; } if (RideCus04) { Cus4TalkCount = PlayerPrefs.GetInt("C4TC_Temp"); //initial = 1; if (Cus4TalkCount == 5) { SoundManager.soundMg.bgm_source.Stop(); rpgTalk.NewTalk("Customer4_Talk5_START", "Cus4Talk5_CutScene1Start", rpgTalk.txtToParse, this, "Cus4Talk5CutScene1"); } else { rpgTalk.NewTalk("Customer4_Talk" + Cus4TalkCount.ToString() + "_START", "Customer4_Talk" + Cus4TalkCount.ToString() + "_END", rpgTalk.txtToParse, this, "AfterCusTalk"); } InitiateTalk = false; } if (RideCus05) { SoundManager.soundMg.bgm_source.Stop(); rpgTalk.NewTalk("Customer5_START", "Cus5Talk_CutScene1Start", rpgTalk.txtToParse, this, "Cus5FinalTalkCutScene1"); InitiateTalk = false; } } //if skip button's pressed, skip chat. only bad ends (chats no.5) cannot be skipped if (SkipButtonPressed) { if (Cus1TalkCount <= 4 && RideCus01 || Cus2TalkCount <= 4 && RideCus02 || Cus3TalkCount <= 4 && RideCus03 || Cus4TalkCount <= 4 && RideCus04) { rpgTalk.EndTalk(); } SkipButtonPressed = false; } }
// Update is called once per frame void Update() { Debug.Log(touching); //skip the Talk to the end if (Input.GetKeyDown(KeyCode.Return)) { rpgTalk.EndTalk(); } //if the user have the controls if (controls) { //let's move around! float moveX = Input.GetAxis("Horizontal"); float moveY = Input.GetAxis("Vertical"); rigid.MovePosition(new Vector2(transform.position.x + moveX * speed, transform.position.y + moveY * speed)); //Not the best way to do it but... change the animator if (moveX > 0) { anim.SetBool("side", true); anim.SetBool("top", false); anim.SetBool("bottom", false); render.flipX = true; anim.speed = 10; } else if (moveX < 0) { anim.SetBool("side", true); anim.SetBool("top", false); anim.SetBool("bottom", false); render.flipX = false; anim.speed = 1; } else if (moveY < 0) { anim.SetBool("side", false); anim.SetBool("top", false); anim.SetBool("bottom", true); anim.speed = 1; } else if (moveY > 0) { anim.SetBool("side", false); anim.SetBool("top", true); anim.SetBool("bottom", false); anim.speed = 1; } else { anim.speed = 0; } //if the player hits E, check if it is talking with someone if (Input.GetKeyDown(KeyCode.E)) { if (touching == "FunnyGuy") { controls = false; rpgTalk.lineToStart = 15; rpgTalk.lineToBreak = 16; rpgTalk.callbackFunction = "WhoAreYou"; rpgTalk.NewTalk(); } if (touching == "Girl") { controls = false; rpgTalk.lineToStart = 33; rpgTalk.lineToBreak = 39; rpgTalk.callbackFunction = "GiveBackControls"; rpgTalk.shouldStayOnScreen = false; rpgTalk.NewTalk(); } } } else { anim.speed = 0; } }
void EndTalk() { rpgTalkToFollow.EndTalk (); }
// ATUALIZAÇÕES DO JOGO public void Update() { timer += Time.deltaTime; if (!showMissionStart) { if (mission != null) { mission.UpdateMission(); } if (sideQuest != null) { sideQuest.UpdateSideQuest(); } if (CrossPlatformInputManager.GetButtonDown("EndText")) { rpgTalk.EndTalk(); } if (!blocked && (!paused || Book.show) && CrossPlatformInputManager.GetButtonDown("keyInvert") && !invertWorldBlocked) { scenerySounds.PlayDemon(6); InvertWorld(!invertWorld); } } else { if (CrossPlatformInputManager.GetButtonDown("JumpText")) { HideLevelImage(); } } // CONDIÇÃO PARA SAIR - MENU if (CrossPlatformInputManager.GetButtonDown("Exit")) { LoadScene("MainMenu"); } // CHEATS if (Input.GetKeyDown(KeyCode.Alpha1)) { ChangeMission(1); } else if (Input.GetKeyDown(KeyCode.Alpha2)) { ChangeMission(2); } else if (Input.GetKeyDown(KeyCode.Alpha3)) { ChangeMission(3); } else if (Input.GetKeyDown(KeyCode.Alpha4)) { ChangeMission(4); } else if (Input.GetKeyDown(KeyCode.Alpha5)) { ChangeMission(5); } else if (Input.GetKeyDown(KeyCode.Alpha6)) { ChangeMission(6); } else if (Input.GetKeyDown(KeyCode.Alpha7)) { ChangeMission(7); } else if (Input.GetKeyDown(KeyCode.Alpha8)) { ChangeMission(8); } else if (Input.GetKeyDown(KeyCode.Alpha9)) { ChangeMission(9); } else if (Input.GetKeyDown(KeyCode.T)) { ChangeMission(10); } else if (Input.GetKeyDown(KeyCode.Y)) { ChangeMission(11); } else if (Input.GetKeyDown(KeyCode.U)) { ChangeMission(12); } else if (Input.GetKeyDown(KeyCode.Alpha0)) { LoadGame(0); } else if (Input.GetKeyDown(KeyCode.G)) { GameOver(); } }
public void SkipRadioCallChat() { rpgtalk.EndTalk(); }