/** * 武器姿态动作 */ private void ChangeAction() { switch (weaponStandardAction.posture - Random.Range(1, 2)) { case 0: weaponStandardAction.leftPosition(); break; case 1: weaponStandardAction.rightPosition(); break; case 2: weaponStandardAction.upPosition(); break; default: weaponStandardAction.upPosition(); break; } }
/** * 武器动作 */ private void WeaponAction() { bool leftMouse = Input.GetButton("Fire1"); bool leftMouseUp = Input.GetButtonUp("Fire1"); // if (leftMouse) // { // weaponStandardAction.PreAttack(); // } else if (leftMouseUp) // { // weaponStandardAction.Attack(); // } if (leftMouseUp) { weaponStandardAction.PreAttack(); } else { //上下 float mousey = Input.GetAxis("Mouse Y"); //左右 float mousex = Input.GetAxis("Mouse X") * mouseSpeed; if (mousey > 0.5) { weaponStandardAction.upPosition(); } else if (mousex > 0.5) { weaponStandardAction.rightPosition(); } else if (mousex < -0.5) { weaponStandardAction.leftPosition(); } } }