public override void RenderInspectorGui() { base.RenderInspectorGui(); GUILayout.Space(10); GUILayout.Label("Rating", EditorStyles.boldLabel); Excitement = EditorGUILayout.Slider("Excitement (" + GetRatingCategory(Excitement) + ")", Excitement, 0, 1); Intensity = EditorGUILayout.Slider("Intensity (" + GetRatingCategory(Intensity) + ")", Intensity, 0, 1); Nausea = EditorGUILayout.Slider("Nausea (" + GetRatingCategory(Nausea) + ")", Nausea, 0, 1); GUILayout.Space(10); ClosedAngleRetraints = EditorGUILayout.Vector3Field("Closed Restraints Angle", ClosedAngleRetraints); GUILayout.Space(10); GUI.color = Color.white; XSize = EditorGUILayout.IntField("X", XSize); ZSize = EditorGUILayout.IntField("Z", ZSize); FlatRideCategory = ATTRACTION_CATEGORY_TAGS[EditorGUILayout.Popup("category", Array.IndexOf(ATTRACTION_CATEGORY_TAGS, FlatRideCategory), ATTRACTION_CATEGORY_INDEX)]; WaypointDecorator waypointDecorator = (WaypointDecorator)GetDecorator(typeof(WaypointDecorator), false); if (waypointDecorator != null && waypointDecorator.EnableEditing) { if (GUILayout.Button("Generate outer grid")) { float minX = -XSize / 2; float maxX = XSize / 2; float minZ = -ZSize / 2; float maxZ = ZSize / 2; for (int xi = 0; xi < Mathf.RoundToInt(maxX - minX); xi++) { for (int zi = 0; zi < Mathf.RoundToInt(maxZ - minZ); zi++) { float x = minX + xi; float z = minZ + zi; if (!(x == minX || x == maxX - 1) && !(z == minZ || z == maxZ - 1)) { continue; } SPWaypoint newWaypoint = new SPWaypoint(); newWaypoint.localPosition = new Vector3(x + 0.5f, waypointDecorator.HelperPlaneY, z + 0.5f); newWaypoint.isOuter = true; waypointDecorator.Waypoints.Add(newWaypoint); } } } } }
public override void BindToParkitect(GameObject hider, AssetBundle bundle) { BaseDecorator baseDecorator = DecoratorByInstance <BaseDecorator>(); WaypointDecorator waypointDecorator = DecoratorByInstance <WaypointDecorator>(); BoundingBoxDecorator boundingBoxDecorator = DecoratorByInstance <BoundingBoxDecorator>(); ColorDecorator colorDecorator = DecoratorByInstance <ColorDecorator>(); GameObject gameObject = Instantiate(bundle.LoadAsset <GameObject>(Key)); RemapUtility.RemapMaterials(gameObject); waypointDecorator.Decorate(gameObject, hider, this, bundle); CustomFlatRide flatride = gameObject.AddComponent <CustomFlatRide>(); baseDecorator.Decorate(gameObject, hider, this, bundle); colorDecorator.Decorate(gameObject, hider, this, bundle); _flatRide = flatride; _flatRide.name = Key; flatride.xSize = XSize; flatride.zSize = ZSize; flatride.excitementRating = Excitement; flatride.intensityRating = Intensity; flatride.nauseaRating = Nausea; RestraintRotationController controller = gameObject.AddComponent <RestraintRotationController>(); controller.closedAngles = ClosedAngleRetraints; //Basic FlatRide Settings flatride.fenceStyle = AssetManager.Instance.rideFenceStyles.rideFenceStyles[0].identifier; flatride.entranceGO = AssetManager.Instance.attractionEntranceGO; flatride.exitGO = AssetManager.Instance.attractionExitGO; flatride.categoryTag = FlatRideCategory; flatride.defaultEntranceFee = 1f; flatride.entranceExitBuilderGO = AssetManager.Instance.flatRideEntranceExitBuilderGO; AssetManager.Instance.registerObject(_flatRide); }