void Update() { bool spell = Input.GetKeyDown(KeyCode.Mouse1); bool firing = Input.GetKeyDown(KeyCode.Mouse0); bool jumping = (Input.GetAxis("Jump") == 1) ? true : false; inputx = Input.GetAxis("Horizontal"); inputy = Input.GetAxis("Vertical"); if (firing) { anin.SetTrigger("attacking"); swordScript.AttackMade(); } if (spell) { CastingSpell(); } if (jumping && !jump && canJump == true) { jump = true; anin.SetBool("jump", true); rigid.AddForce(new Vector3((jumpingForce * 3) * inputx, jumpingForce, (jumpingForce * 3)), ForceMode.Force); } if (inputy != 0 || inputx != 0) { anin.SetBool("run", true); Rotation(); if (Input.GetKey(KeyCode.LeftShift)) { anin.SetBool("running", true); } else { anin.SetBool("running", false); } } else { anin.SetBool("run", false); transform.rotation.Normalize(); } if (Input.GetKeyDown(KeyCode.Q)) { if (primaryScript.guaravitas > 0) { primaryScript.CalculateLife(50, false, true); } } if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } }
private void OnCollisionEnter(Collision collision) { if (collision.gameObject.CompareTag("Bullet")) { Debug.Log(collision.gameObject.tag); } else if (collision.gameObject.CompareTag("Player")) { Debug.Log("Enemy Hit"); primaryScript.CalculateLife(10, true, false); } }