修改水
This commit is contained in:
@@ -4,7 +4,6 @@ using UnityEngine.SceneManagement;
|
||||
using UnityEditor;
|
||||
using UnityEditor.SceneManagement;
|
||||
using System.IO;
|
||||
using UnityEngine.Rendering;
|
||||
|
||||
namespace Obi{
|
||||
|
||||
@@ -128,7 +127,17 @@ namespace Obi{
|
||||
public static GameObject CreateNewSolver()
|
||||
{
|
||||
// Root for the actors.
|
||||
var root = new GameObject("Obi Solver", typeof(ObiSolver));
|
||||
var root = new GameObject("Obi Solver");
|
||||
ObiSolver solver = root.AddComponent<ObiSolver>();
|
||||
|
||||
// Try to find a fixed updater in the scene (though other kinds of updaters can exist, updating in FixedUpdate is the preferred option).
|
||||
ObiFixedUpdater updater = StageUtility.GetCurrentStageHandle().FindComponentOfType<ObiFixedUpdater>();
|
||||
// If we could not find an fixed updater in the scene, add one to the solver object.
|
||||
if (updater == null)
|
||||
updater = root.AddComponent<ObiFixedUpdater>();
|
||||
|
||||
// Add the solver to the updater:
|
||||
updater.solvers.Add(solver);
|
||||
|
||||
// Works for all stages.
|
||||
StageUtility.PlaceGameObjectInCurrentStage(root);
|
||||
@@ -221,34 +230,7 @@ namespace Obi{
|
||||
// Return the currently selected item's index
|
||||
return selected;
|
||||
}
|
||||
|
||||
public static void DrawArrowHandle(Vector3 posA, Vector3 posB, float headAngle = 30, float headLength = 0.18f)
|
||||
{
|
||||
Handles.DrawLine(posA, posB);
|
||||
|
||||
var look = Quaternion.LookRotation(posA - posB, Camera.current.transform.forward);
|
||||
var one = look * Quaternion.Euler(0, 180 + headAngle, 0) * new Vector3(0, 0, 1);
|
||||
var two = look * Quaternion.Euler(0, 180 - headAngle, 0) * new Vector3(0, 0, 1);
|
||||
|
||||
var sizeA = HandleUtility.GetHandleSize(posA) * headLength;
|
||||
Handles.DrawLine(posA, posA + one * sizeA);
|
||||
Handles.DrawLine(posA, posA + two * sizeA);
|
||||
|
||||
var sizeB = HandleUtility.GetHandleSize(posB) * headLength;
|
||||
Handles.DrawLine(posB, posB - one * sizeB);
|
||||
Handles.DrawLine(posB, posB - two * sizeB);
|
||||
}
|
||||
|
||||
public static Material GetDefaultMaterial()
|
||||
{
|
||||
if (GraphicsSettings.defaultRenderPipeline != null)
|
||||
{
|
||||
return GraphicsSettings.defaultRenderPipeline.defaultMaterial;
|
||||
}
|
||||
else
|
||||
{
|
||||
return AssetDatabase.GetBuiltinExtraResource<Material>("Default-Diffuse.mat");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Obi
|
||||
{
|
||||
|
||||
[CustomEditor(typeof(ObiFoamGenerator)), CanEditMultipleObjects]
|
||||
public class ObiFoamGeneratorEditor : Editor
|
||||
{
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
serializedObject.UpdateIfRequiredOrScript();
|
||||
|
||||
DrawPropertiesExcluding(serializedObject, "m_Script");
|
||||
|
||||
// Apply changes to the serializedProperty
|
||||
if (GUI.changed)
|
||||
serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b9656e2c54d9e4c478c74ca6d97428f8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -15,7 +15,6 @@ namespace Obi
|
||||
SerializedProperty targetTransform;
|
||||
SerializedProperty particleGroup;
|
||||
SerializedProperty attachmentType;
|
||||
SerializedProperty projectPosition;
|
||||
SerializedProperty constrainOrientation;
|
||||
SerializedProperty compliance;
|
||||
SerializedProperty breakThreshold;
|
||||
@@ -29,10 +28,9 @@ namespace Obi
|
||||
targetTransform = serializedObject.FindProperty("m_Target");
|
||||
particleGroup = serializedObject.FindProperty("m_ParticleGroup");
|
||||
attachmentType = serializedObject.FindProperty("m_AttachmentType");
|
||||
projectPosition = serializedObject.FindProperty("m_Projection");
|
||||
constrainOrientation = serializedObject.FindProperty("m_ConstrainOrientation");
|
||||
compliance = serializedObject.FindProperty("m_Compliance");
|
||||
breakThreshold = serializedObject.FindProperty("breakThreshold");
|
||||
breakThreshold = serializedObject.FindProperty("m_BreakThreshold");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
@@ -57,16 +55,7 @@ namespace Obi
|
||||
}
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
Transform trget = EditorGUILayout.ObjectField("Target", attachment.target, typeof(Transform), true) as Transform;
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
Undo.RecordObject(attachment, "Set target");
|
||||
attachment.target = trget;
|
||||
PrefabUtility.RecordPrefabInstancePropertyModifications(attachment);
|
||||
}
|
||||
|
||||
|
||||
EditorGUILayout.PropertyField(targetTransform, new GUIContent("Target"));
|
||||
var blueprint = attachment.actor.sourceBlueprint;
|
||||
|
||||
if (blueprint != null)
|
||||
@@ -100,7 +89,6 @@ namespace Obi
|
||||
|
||||
if (attachment.attachmentType == ObiParticleAttachment.AttachmentType.Dynamic)
|
||||
{
|
||||
EditorGUILayout.PropertyField(projectPosition, new GUIContent("Projection"));
|
||||
EditorGUILayout.PropertyField(compliance, new GUIContent("Compliance"));
|
||||
EditorGUILayout.PropertyField(breakThreshold, new GUIContent("Break threshold"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user