public override void OnInspectorGUI()
        {
            VehicleController vehicleController = (VehicleController)target;

            GUILayout.Space(40);
            lastRect = GUILayoutUtility.GetLastRect();

            DrawDefaultInspector();
            TrailerSettings();
            GeneralSettings();

            if (!vehicleController.GetComponent <DesktopInputManager>() &&
                !vehicleController.GetComponent <MobileInputManager>())
            {
                EditorGUILayout.HelpBox(
                    "Using input from vehicle manager or other external source. Check 'Input' section inside manual for other options.",
                    MessageType.Info, true);
            }

            if (Time.fixedDeltaTime > 0.017f)
            {
                EditorGUILayout.HelpBox(
                    "Fixed Delta Time is " + Time.fixedDeltaTime + ". It is recommended to use 0.017 or lower.",
                    MessageType.Warning, true);
            }

            if (logo != null)
            {
                float width      = Screen.width;
                float height     = 53f;
                float logoHeight = height * 0.7f;
                float logoWidth  = logoHeight * 8.34f;

                GUIDrawRect(new Rect(0, lastRect.y + 3, width, height), new Color(0.89f, 0.89f, 0.89f));
                GUI.DrawTexture(
                    new Rect(lastRect.x + width * 0.5f - logoWidth * 0.55f,
                             lastRect.y + height * 0.5f - logoHeight * 0.4f, logoWidth, logoHeight), logo);
            }

            serializedObject.ApplyModifiedProperties();
            EditorUtility.SetDirty(vehicleController);
        }
Ejemplo n.º 2
0
        void Update()
        {
            if (vehicleChanger != null)
            {
                vehicleController = vehicleChanger.ActiveVehicleController;
            }

#if PHOTON_MULTIPLAYER
            // Check if selected vehicle has photon view and if it does, if it is mine.
            PhotonView photonView = vehicleController?.GetComponent <PhotonView>();
            if (photonView)
            {
                if (!photonView.isMine)
                {
                    return;
                }
            }
#endif

            UpdateSteering();
        }