示例#1
0
    void ThrowCurrentWeapon()
    {
        if (GetCurrentWeapon() != null)
        {
            print("throwing weapon");

            float throwForceAmp = 300f;
            GetCurrentWeaponGO().AddComponent <Rigidbody>();
            GetCurrentWeaponGO().GetComponent <Rigidbody>().AddForce(cam.transform.forward * throwForceAmp / GetCurrentWeapon().mass);
            GetCurrentWeaponGO().transform.parent      = null;
            inventory.inventory[wp.weaponSelected - 1] = 0;

            print("weapon thrown");

            if (wp.ChangeWeapon(1))
            {
                ;
            }
            else if (wp.ChangeWeapon(2))
            {
                ;
            }
            else
            {
                wp.ChangeWeapon(3);
            }
        }
    }