private void actualizaPlayerLocation() { // Test parpadeo de minimapa //Zona zona = (Zona)currentLocation; Vector2 position = Direction(currentLocation); blinkPlayer.StopBlink(false); blinkPlayer.StartBlink(position.x, position.y); blinkPlayer.StopBlink(true); }
private void actualizaWarning() { // Test parpadeo de minimapa //Zona zona = (Zona)currentTarget; Vector2 position = Direction(currentTarget); blinkWarning.StopBlink(false); blinkWarning.StartBlink(position.x, position.y); }
// Update is called once per frame private void Update() { float h = Input.GetAxis("Horizontal"); if (h >= 0.1f) { transform.localScale = Vector3.one; } else if (h <= -0.1f) { transform.localScale = new Vector3(-1f, 1f, 1f); } isGrounded = Physics2D.OverlapCircle(groundCheck.position, 0.1f, groundLayer); UpdateSpeedMultiplier(); if (Input.GetAxis("Horizontal") != 0f) { Move(); } if ((Input.GetButtonDown("Jump") || Input.GetKeyDown(KeyCode.W) || Input.GetKeyDown(KeyCode.UpArrow)) && isGrounded) { Jump(); } if (Input.GetMouseButtonDown(0) && canAttack && !isAttacking && !isDefending) { canAttack = false; EnableAttack(true); Invoke("StopAttack", attackDuration); Invoke("ResetCanAttack", attackCooldown); soundManager.PlaySFX(SoundManager.SFXType.PLAYER_ATTACK, 0.5f); } else if (Input.GetMouseButtonDown(1) && !isAttacking && !isDefending) { EnableDefense(true); } if (Input.GetMouseButtonUp(1) && isDefending) { EnableDefense(false); } healthBar.size = health / maxHealth; if (blinking) { blink.StartBlink(); } else { blink.StopBlink(); } }
// Update is called once per frame void Update() { if (blink != null) { if (canBeHit) { blink.StopBlink(); } else { blink.StartBlink(); } } }