// Update is called once per frame void Update() { if (isDead) { return; } //Si se llega a un punto, la posición de destino será el otro punto if (transform.position == pointA.position) { nextPos = pointB.position; FlipCharacterDirection(); } if (transform.position == pointB.position) { nextPos = pointA.position; FlipCharacterDirection(); } if (isRecovered && !isAttacking) { //Se mueve el personaje transform.position = Vector3.MoveTowards(transform.position, nextPos, speed * Time.deltaTime); //Animación de moverse anim.SetBool("isMoving", true); if (assetAudio.GetNameSound() != "Walking") { assetAudio.PlaySound("Walking"); } } if (transform.position == pointB.position) { nextPos = pointA.position; } //Se pausan los sonidos en al estar en menús if (SceneController.inMenu) { assetAudio.aSource.Pause(); } //Se reanudan los sonidos al dejar de estar en menús if (!SceneController.inMenu && !assetAudio.aSource.isPlaying) { assetAudio.aSource.UnPause(); } if (player.isDead) { GetComponent <BoxCollider2D>().enabled = false; topEnemy.gameObject.GetComponent <BoxCollider2D>().enabled = false; } }
// Update is called once per frame void Update() { if (transform.position == pointA.position) { StartCoroutine(MoveDown()); //Sonido if (assetAudio.GetNameSound() == "MoveUp") { assetAudio.StopSound("MoveUp"); } } if (transform.position == pointB.position) { StartCoroutine(MoveUp()); //Sonido if (assetAudio.GetNameSound() != "Impact") { assetAudio.PlaySound("Impact"); } } //Sonido if (isMovingUp && assetAudio.GetNameSound() != "MoveUp") { assetAudio.PlaySound("MoveUp"); } //Se pausan los sonidos en al estar en menús if (SceneController.inMenu) { assetAudio.aSource.Pause(); } //Se reanudan los sonidos al dejar de estar en menús if (!SceneController.inMenu && !assetAudio.aSource.isPlaying) { assetAudio.aSource.UnPause(); } transform.position = Vector3.MoveTowards(transform.position, nextPos, speed * Time.deltaTime); }
// Update is called once per frame void Update() { if (playerCollision) { StartCoroutine(FadeIn(timeToStartFade)); } if (startFadeOut && !isFadingIn) { //Sonido if (assetAudio.GetNameSound() != "Appear") { assetAudio.PlaySound("Appear"); } StartCoroutine(FadeOut(timeToStartFade)); } //Sonido if (isFadingIn && (assetAudio.GetNameSound() != "Disappear")) { assetAudio.PlaySound("Disappear"); } }