コード例 #1
0
ファイル: GroundDetection.cs プロジェクト: ZRace/ZRace
        public override void SetDefaults(VehicleController vc)
        {
            base.SetDefaults(vc);

            if (groundDetectionPreset == null)
            {
                groundDetectionPreset =
                    Resources.Load(VehicleController.DEFAULT_RESOURCES_PATH + "DefaultGroundDetectionPreset")
                    as GroundDetectionPreset;
            }
        }
コード例 #2
0
ファイル: GroundDetectionDrawer.cs プロジェクト: ZRace/ZRace
        public override bool OnNUI(Rect position, SerializedProperty property, GUIContent label)
        {
            if (!base.OnNUI(position, property, label))
            {
                return(false);
            }

            drawer.Field("groundDetectionPreset");

            GroundDetectionPreset gdPreset =
                ((GroundDetection)(SerializedPropertyHelper.GetTargetObjectOfProperty(property)
                                   as VehicleComponent))?.groundDetectionPreset;

            if (gdPreset != null)
            {
                drawer.EmbeddedObjectEditor(gdPreset, drawer.positionRect);
            }

            drawer.BeginSubsection("Debug Info");
            GroundDetection groundDetection =
                SerializedPropertyHelper.GetTargetObjectOfProperty(drawer.serializedProperty) as GroundDetection;

            if (groundDetection != null && groundDetection.VehicleController != null)
            {
                for (int i = 0; i < groundDetection.VehicleController.powertrain.wheels.Count; i++)
                {
                    WheelComponent wheelComponent = groundDetection.VehicleController.powertrain.wheels[i];
                    if (wheelComponent != null)
                    {
                        drawer.Label($"{wheelComponent.name}: {wheelComponent.surfacePreset?.name} SurfacePreset");
                    }
                }
            }
            else
            {
                drawer.Info("Debug info is available only in play mode.");
            }

            drawer.EndSubsection();


            drawer.EndProperty();
            return(true);
        }
コード例 #3
0
        public override bool OnInspectorNUI()
        {
            if (!base.OnInspectorNUI())
            {
                return(false);
            }

            preset = (GroundDetectionPreset)target;

            drawer.BeginSubsection("Particles");
            drawer.Field("particlePrefab");
            drawer.Field("chunkPrefab");
            drawer.EndSubsection();

            drawer.BeginSubsection("Surface Maps");
            drawer.Field("fallbackSurfacePreset");
            drawer.ReorderableList("surfaceMaps");
            drawer.EndSubsection();

            drawer.EndEditor(this);
            return(true);
        }