public override void SetDefaults(VehicleController vc) { base.SetDefaults(vc); if (groundDetectionPreset == null) { groundDetectionPreset = Resources.Load(VehicleController.DEFAULT_RESOURCES_PATH + "DefaultGroundDetectionPreset") as GroundDetectionPreset; } }
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); }
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); }