ui基本完毕,修了一大把的bug

This commit is contained in:
2026-07-13 02:28:39 +08:00
parent 1e20d73e90
commit fd22501f71
958 changed files with 378289 additions and 41038 deletions
@@ -0,0 +1,24 @@
using System;
using UnityEngine;
using UnityEngine.Events;
[Serializable]
public class CallbackOptions
{
[Tooltip("This callback is invoked when a fracture has been triggered. Not called for slicing and prefracturing.")]
public UnityEvent<Collider, GameObject, Vector3> onFracture;
[Tooltip("This callback is invoked when the fracturing/slicing process has been completed.")]
public UnityEvent onCompleted;
public CallbackOptions()
{
this.onCompleted = null;
}
public void CallOnFracture(Collider instigator, GameObject fracturedObject, Vector3 point)
{
onFracture?.Invoke(instigator, fracturedObject, point);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 348edbe3d0570a6419accc52b0e212bb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,50 @@
using System;
using UnityEngine;
[Serializable]
/// <summary>
/// Options for fracturing a mesh
/// </summary>
public class FractureOptions
{
[Range(1, 1024)]
[Tooltip("Maximum number of times an object and its children are recursively fractured. Larger fragment counts will result in longer computation times.")]
public int fragmentCount;
[Tooltip("Enables fracturing in the local X plane")]
public bool xAxis;
[Tooltip("Enables fracturing in the local Y plane")]
public bool yAxis;
[Tooltip("Enables fracturing in the local Z plane")]
public bool zAxis;
[Tooltip("Enables detection of \"floating\" fragments when fracturing non-convex meshes. This setting has no effect for convex meshes and should be disabled.")]
public bool detectFloatingFragments;
[Tooltip("Fracturing is performed asynchronously on the main thread.")]
public bool asynchronous;
[Tooltip("The material to use for the inside faces")]
public Material insideMaterial;
[Tooltip("Scale factor to apply to texture coordinates")]
public Vector2 textureScale;
[Tooltip("Offset to apply to texture coordinates")]
public Vector2 textureOffset;
public FractureOptions()
{
this.fragmentCount = 10;
this.xAxis = true;
this.yAxis = true;
this.zAxis = true;
this.detectFloatingFragments = false;
this.asynchronous = false;
this.insideMaterial = null;
this.textureScale = Vector2.one;
this.textureOffset = Vector2.zero;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1a403b44a0def994f9876eb8ee5ec510
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
using System;
using UnityEngine;
[Serializable]
/// <summary>
/// Options for prefracturing a mesh
/// </summary>
public class PrefractureOptions
{
[Tooltip("For prefractured objects, if this property is enabled, the all fragments will unfreeze if a single fragment is interacted with.")]
public bool unfreezeAll;
[Tooltip("Saves the fragment meshes to disk. Required if the fragments will be used in a prefab.")]
public bool saveFragmentsToDisk;
[Tooltip("Path to save the fragments to if saveToDisk is enabled. Relative to the project directory.")]
public string saveLocation;
public PrefractureOptions()
{
this.unfreezeAll = true;
this.saveFragmentsToDisk = false;
this.saveLocation = "";
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1288923c231259a499e20568accf3230
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
/// <summary>
/// Options for refracturing
/// </summary>
public class RefractureOptions
{
[Tooltip("Enables refracturing of fragments. WARNING: This setting can result in a significant amount of generated fragments. It is recommended to keep FragmentCount low if this is enabled.")]
public bool enableRefracturing;
[Tooltip("Maximum number of times a fragment can be re-fractured.")]
[Range(1, 3)]
public int maxRefractureCount;
[Tooltip("Enable if refracturing should also invoke the callback functions.")]
public bool invokeCallbacks;
public RefractureOptions()
{
this.enableRefracturing = false;
this.maxRefractureCount = 1;
this.invokeCallbacks = false;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 16f54522207146b4080c2b883054c223
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class SliceOptions
{
[Tooltip("Enables reslicing of fragments.")]
public bool enableReslicing;
[Tooltip("Maximum number of times a fragment can be re-sliced.")]
[Range(1, 100)]
public int maxResliceCount;
[Tooltip("Enables detection of \"floating\" fragments when slicing non-convex meshes. This setting has no effect for convex meshes and should be disabled.")]
public bool detectFloatingFragments;
[Tooltip("The material to use for the inside faces")]
public Material insideMaterial;
[Tooltip("Scale factor to apply to texture coordinates")]
public Vector2 textureScale;
[Tooltip("Offset to apply to texture coordinates")]
public Vector2 textureOffset;
[Tooltip("Enable if re-slicing should also invoke the callback functions.")]
public bool invokeCallbacks;
public SliceOptions()
{
this.enableReslicing = false;
this.maxResliceCount = 1;
this.insideMaterial = null;
this.textureScale = Vector2.one;
this.textureOffset = Vector2.zero;
this.invokeCallbacks = false;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b00168a0f92544f468d07cb7c6ae6491
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using UnityEngine;
public enum TriggerType
{
Collision,
Trigger,
Keyboard
}
[Serializable]
public class TriggerOptions
{
[Tooltip("The type of input that triggers the fracture.")]
public TriggerType triggerType;
[Tooltip("Minimum contact collision force required to cause the object to fracture.")]
public float minimumCollisionForce;
[Tooltip("If true, only objects with the tags 'Allowed Tags' list will trigger a collision.")]
public bool filterCollisionsByTag;
[Tooltip("If 'Filter Collisions By Tag' is set to true, only objects with the tags in this list will trigger the fracture.")]
public List<string> triggerAllowedTags;
[Tooltip("If the trigger type is Keyboard, this is the key code that will trigger a fracture when pressed.")]
public KeyCode triggerKey;
public TriggerOptions()
{
this.triggerType = TriggerType.Collision;
this.minimumCollisionForce = 0f;
this.filterCollisionsByTag = false;
this.triggerAllowedTags = new List<string>();
this.triggerKey = KeyCode.None;
}
/// <summary>
/// Returns true if the specified tag is allowed to trigger the fracture
/// </summary>
/// <param name="tag">The tag to check</param>
/// <returns></returns>
public bool IsTagAllowed(string tag)
{
return triggerAllowedTags.Contains(tag);
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 23860b87355c53642bbc74c4577baacf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: