//旋轉物件 及丟出 private void ThrowControl() { if (hookObj.transform.childCount != 0 && Input.GetKeyDown(KeyCode.R)) { isThrowing = true; moveControl.SetAttackingStatusTrue(); InvokeRepeating("ThrowParameterControl", 0.5f, 0.5f); } if (hookObj.transform.childCount != 0 && Input.GetKey(KeyCode.R)) { transform.Rotate(Vector3.up * throwRotateSpeed * Time.deltaTime); if (throwRotateSpeed >= 1000f) { CancelInvoke(); } } if (hookObj.transform.childCount != 0 && Input.GetKeyUp(KeyCode.R)) { hookObj.transform.GetChild(0).GetComponent <PositionConstraint>().constraintActive = false; //for PositionConstraint @@@@@@ hookObj.transform.GetChild(0).GetComponent <Rigidbody>().AddForce(throwForce * this.transform.right, ForceMode.Impulse); hookGun.RealeaseChild(); CancelInvoke(); throwForce = oriThrowForce; throwRotateSpeed = oriThrowRotateSpeed; isThrowing = false; moveControl.SetAttackingStatusFalse(); } }
//isShotting void SetShootingStatusTrue() { isShooting = true; moveControl.SetAttackingStatusTrue(); }