Esempio n. 1
0
    //旋轉物件 及丟出
    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();
        }
    }
Esempio n. 2
0
 void SetShootingStatusFalse()
 {
     isShooting = false;
     moveControl.SetAttackingStatusFalse();
 }