void Update() { healthSlider.value = health; move = Input.GetAxis("Horizontal"); anim.SetFloat("Speed", Mathf.Abs(move)); curTalisman = habilities[selectedTalisman]; levelTag.text = "level " + curTalisman.level; talismanSimbol.sprite = curTalisman.simbol; experienceSlider.value = curTalisman.energy; if (curTalisman.level != 1) experienceSlider.minValue = curTalisman.energytresholds[curTalisman.level - 2]; else experienceSlider.minValue = 0; experienceSlider.maxValue = curTalisman.energytresholds[curTalisman.level - 1]; if (!dashing) { if (Input.GetButton("Run")) { GetComponent<Rigidbody2D>().velocity = new Vector2(move * maxSpeed * 1.7f, GetComponent<Rigidbody2D>().velocity.y); } else { GetComponent<Rigidbody2D>().velocity = new Vector2(move * maxSpeed, GetComponent<Rigidbody2D>().velocity.y); } if (move > 0 && !facingRight) Flip(); else if (move < 0 && facingRight) Flip(); } if (Input.GetButtonDown("Jump") && (grounded)) { grounded = false; GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, GetComponent<Rigidbody2D>().velocity.y + jumpforce); } if (Input.GetButton("Jump") && GetComponent<Rigidbody2D>().velocity.y > 0 && !(grounded)) { grounded = false; extraspeed -= Time.deltaTime * 50; jumpforce += Time.deltaTime * extraspeed; GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, jumpforce); } if (!grounded && !Input.GetButton("Jump")) jumpforce = 0f; if (Input.GetButtonDown("SwitchUp")) { if (selectedTalisman != 3) selectedTalisman++; else selectedTalisman = 0; } if (Input.GetButtonDown("SwitchDown")) { if (selectedTalisman != 0) selectedTalisman--; else selectedTalisman = 3; } if (Input.GetButtonDown("Action")) { if (selectedTalisman != 0) curTalisman.activate(); } if (Input.GetButton("Action")) { if (selectedTalisman == 2) { curTalisman.activate(); } } }