// Update is called once per frame void Update() { if (!input.canMove || aimControl.target == null) { return; } if (Input.GetButtonDown("Fire1")) { swordControl.ShowSword(); anim.SetTrigger("slash"); input.canMove = false; aimControl.LockInterface(true); input.RotateTowards(aimControl.target); } }
// Update is called once per frame void Update() { reference.position = cutPlane.GetChild(0).position; if (Input.GetButtonDown("Fire3") && !bladeMode) { swordControl.ShowSword(); SetMode(true); } else if (Input.GetButtonDown("Fire3") && bladeMode) { StartCoroutine(swordControl.HideSword()); SetMode(false); } if (bladeMode) { Quaternion forward = Camera.main.transform.rotation; forward.x = forward.z = 0; transform.rotation = Quaternion.Lerp(transform.rotation, forward, .2f); RotateCutPlane(); anim.SetFloat("x", Mathf.Clamp(reference.localPosition.x, -1, 1)); anim.SetFloat("y", Mathf.Clamp(reference.localPosition.y, -1, 1)); } }