コード例 #1
0
ファイル: Ship.cs プロジェクト: Dirker27/WraithSquadron
    // Update is called once per frame
    void Update()
    {
        // Cripple Ship
        if (hullIntegrity <= 0f && crippled == false)
        {
            crippled = true;

            GetComponent <Rigidbody>().useGravity  = true;
            GetComponent <Rigidbody>().velocity    = flightControl.trajectory;
            GetComponent <Rigidbody>().drag        = 0f;
            GetComponent <Rigidbody>().angularDrag = 0.01f;
            GetComponent <Rigidbody>().AddTorque(flightControl.trajectory * 1000f);
        }

        if (!crippled)
        {
            GetControls();

            flightControl.Steer(steer);
            flightControl.Throttle(throttle, brake);

            if (primaryWeapon != null && primaryFire)
            {
                primaryWeapon.Fire();
            }
            if (secondaryWeapon != null && secondaryFire)
            {
                secondaryWeapon.Fire();
            }
        }
    }