// Update is called once per frame void Update() { if (!dead) { if (!damaged) { if (Input.GetKeyDown(KeyCode.Z)) { if (dishots.cantidad > 0 && !dishots.shots[dishots.cantidad - 1].gameObject.activeInHierarchy) { dishots.cantidad--; dishots.shots[dishots.cantidad].GetComponent <Limones>().activar(dir, Time.time, new Vector3(transform.position.x, transform.position.y, 0f)); dishots.shots[dishots.cantidad].gameObject.SetActive(true); } else { dishots.cantidad = 3; } } if (dash.Check() && dash.enUso) { StartCoroutine(bajar(1f)); } if ((Input.GetKeyDown(KeyCode.A) || Input.GetKeyDown(KeyCode.LeftArrow)) && isLookingRight && isOnWall && !isOnGround) { rg.velocity = new Vector2(rg.velocity.x, 7f); } if ((Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.RightArrow)) && !isLookingRight && isOnWall && !isOnGround) { rg.velocity = new Vector2(rg.velocity.x, 7f); } if ((Input.GetKeyDown(KeyCode.UpArrow) || Input.GetKeyDown(KeyCode.W)) && isOnGround) { rg.velocity = new Vector2(rg.velocity.x, 7f); } if (Input.GetKeyDown(KeyCode.X) && (isOnGround || isOnWall) && dash.Check()) { tlr.time = 0.5f; dash.Activar(); } } else { if (collisionIsFinished()) { damaged = false; } } } else { int EnemyLayer = LayerMask.NameToLayer("Enemy"); int PlayerLayer = LayerMask.NameToLayer("Player"); Physics2D.IgnoreLayerCollision(EnemyLayer, PlayerLayer, false); gameObject.SetActive(false); } }