Publish verified live restoration source snapshot and known limits
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class CacheCamera
|
||||
{
|
||||
private Camera _camera;
|
||||
|
||||
private Transform _cacheTransform;
|
||||
|
||||
public Camera camera => _camera;
|
||||
|
||||
public Transform cacheTransform => _cacheTransform;
|
||||
|
||||
public CacheCamera(Camera c)
|
||||
{
|
||||
Set(c);
|
||||
}
|
||||
|
||||
public void Set(Camera c)
|
||||
{
|
||||
_camera = c;
|
||||
if (c == null)
|
||||
{
|
||||
_cacheTransform = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
_cacheTransform = c.GetComponent<Transform>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d123511b74303f64997e298b413a149a
|
||||
timeCreated: 1530763599
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,28 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class Character3DBase : MonoBehaviour
|
||||
{
|
||||
public abstract class Parts
|
||||
{
|
||||
public enum eCategory
|
||||
{
|
||||
Head = 0,
|
||||
Body = 1,
|
||||
Accessory = 2,
|
||||
Unknown = 3,
|
||||
MAX = 4,
|
||||
Invalid = 4
|
||||
}
|
||||
|
||||
public static bool IsValidPartsCode(string partsCode)
|
||||
{
|
||||
bool result = false;
|
||||
int result2 = 0;
|
||||
if (!string.IsNullOrEmpty(partsCode) && partsCode.Length == 4 && int.TryParse(partsCode, out result2))
|
||||
{
|
||||
result = result2 >= 0;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 51cbf6f541e527d47845007a1cb7bbb1
|
||||
timeCreated: 1534994919
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,226 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class ClothParameter
|
||||
{
|
||||
private NativeClothParameter[] _nativeClothParameter = new NativeClothParameter[1]
|
||||
{
|
||||
new NativeClothParameter
|
||||
{
|
||||
_stiffnessForceRate = 1f,
|
||||
_dragForceRate = 1f,
|
||||
_gravityRate = 1f,
|
||||
_collisionSwitch = true,
|
||||
_capability0 = CySpring.eCapability.None,
|
||||
_capability1 = CySpring.eCapability.None,
|
||||
_capability2 = CySpring.eCapability.None,
|
||||
_capability3 = CySpring.eCapability.None,
|
||||
_capability4 = CySpring.eCapability.None,
|
||||
_gravityDirection0 = Vector3.down,
|
||||
_gravityDirection1 = Vector3.down,
|
||||
_gravityDirection2 = Vector3.down,
|
||||
_gravityDirection3 = Vector3.down,
|
||||
_gravityDirection4 = Vector3.down,
|
||||
_forceScale = Vector3.one
|
||||
}
|
||||
};
|
||||
|
||||
public NativeClothParameter[] nativeClothParameter => _nativeClothParameter;
|
||||
|
||||
public float stiffnessForceRate
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._stiffnessForceRate;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._stiffnessForceRate = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float dragForceRate
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._dragForceRate;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._dragForceRate = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float gravityRate
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._gravityRate;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._gravityRate = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool collisionSwitch
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._collisionSwitch;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._collisionSwitch = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CySpring.eCapability capability0
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._capability0;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._capability0 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CySpring.eCapability capability1
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._capability1;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._capability1 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CySpring.eCapability capability2
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._capability2;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._capability2 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CySpring.eCapability capability3
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._capability3;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._capability3 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CySpring.eCapability capability4
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._capability4;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._capability4 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 gravityDirection0
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._gravityDirection0;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._gravityDirection0 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 gravityDirection1
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._gravityDirection1;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._gravityDirection1 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 gravityDirection2
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._gravityDirection2;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._gravityDirection2 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 gravityDirection3
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._gravityDirection3;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._gravityDirection3 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 gravityDirection4
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._gravityDirection4;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._gravityDirection4 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 forceScale
|
||||
{
|
||||
get
|
||||
{
|
||||
return _nativeClothParameter[0]._forceScale;
|
||||
}
|
||||
set
|
||||
{
|
||||
_nativeClothParameter[0]._forceScale = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetCapability()
|
||||
{
|
||||
capability0 = CySpring.eCapability.None;
|
||||
capability1 = CySpring.eCapability.None;
|
||||
capability2 = CySpring.eCapability.None;
|
||||
capability3 = CySpring.eCapability.None;
|
||||
capability4 = CySpring.eCapability.None;
|
||||
}
|
||||
|
||||
public void ExcludeCapability(CySpring.eCapability caps)
|
||||
{
|
||||
capability0 &= ~caps;
|
||||
capability1 &= ~caps;
|
||||
capability2 &= ~caps;
|
||||
capability3 &= ~caps;
|
||||
capability4 &= ~caps;
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3dab7ab7ce1ac354683d00c2e36a393c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,304 +0,0 @@
|
||||
// CySpring
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Stage;
|
||||
using UnityEngine;
|
||||
|
||||
public class CySpring : MonoBehaviour
|
||||
{
|
||||
public enum eCapability
|
||||
{
|
||||
None,
|
||||
GravityControl,
|
||||
WindForce
|
||||
}
|
||||
|
||||
public class CollisionParent
|
||||
{
|
||||
public Transform transform;
|
||||
}
|
||||
|
||||
public struct BindContext
|
||||
{
|
||||
public NativeClothCollision[] commonNativeCollisions;
|
||||
|
||||
public CollisionParent[] commonCollisionParentTable;
|
||||
|
||||
public CySpringCollisionComponent[] commonUnionCollisionList;
|
||||
|
||||
public Vector3[] commonCollisionParentWorldPosition;
|
||||
|
||||
public Quaternion[] commonCoollisionParentWorldRotation;
|
||||
}
|
||||
|
||||
private const float DEFAULT_SPECIFIC_RATE = 0.1f;
|
||||
|
||||
private const float HALF_FPS_RATE = 1.5f;
|
||||
|
||||
private static List<CySpringCollisionComponent> _lstUnionCollision = null;
|
||||
|
||||
private static CySpringCollisionComponent _groundCollision = null;
|
||||
|
||||
private static float _stiffnessForceRate = 1f;
|
||||
|
||||
private static float _dragForceRate = 1f;
|
||||
|
||||
private static float _gravityRate = 1f;
|
||||
|
||||
private bool _bCollisionSwitch = true;
|
||||
|
||||
[SerializeField]
|
||||
private CySpringParamDataAsset _springData;
|
||||
|
||||
private bool _bUseUnionCollision;
|
||||
|
||||
private CySpringCollisionComponent _unionCollision;
|
||||
|
||||
private CySpringCollisionComponent[] _unionCollisionList;
|
||||
|
||||
private CySpringCollisionComponent[] _collisionList;
|
||||
|
||||
public NativeClothCollision[] _nativeCollisions;
|
||||
|
||||
private CollisionParent[] _collisionParentTable;
|
||||
|
||||
private Vector3[] _collisionParentWorldPosition;
|
||||
|
||||
private Quaternion[] _collisionParentWorldRotation;
|
||||
|
||||
[NonSerialized]
|
||||
private float _sqartDeltaTime;
|
||||
|
||||
[SerializeField]
|
||||
private CySpringRootBone[] _boneList;
|
||||
|
||||
[NonSerialized]
|
||||
private Transform _cachedTransform;
|
||||
|
||||
private bool _isUseSpecificValue;
|
||||
|
||||
private float _specificStiffnessForceRate = 0.1f;
|
||||
|
||||
private float _specificDragForceRate = 0.1f;
|
||||
|
||||
private float _specificGravityRate = 0.1f;
|
||||
|
||||
private bool _needWorldRotationShare;
|
||||
|
||||
private Transform _oftenAccessedParent;
|
||||
|
||||
private static readonly string[] IgnoreTransformName = new string[8] { "Pole_Arm_L", "Pole_Arm_R", "Pole_Leg_L", "Pole_Leg_R", "Eff_Leg_L", "Eff_Leg_R", "Eff_Wrist_L", "Eff_Wrist_R" };
|
||||
|
||||
private static bool _unbinded = false;
|
||||
|
||||
public static float stiffnessForceRate
|
||||
{
|
||||
set
|
||||
{
|
||||
_stiffnessForceRate = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static float dragForceRate
|
||||
{
|
||||
set
|
||||
{
|
||||
_dragForceRate = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static float gravityRate
|
||||
{
|
||||
set
|
||||
{
|
||||
_gravityRate = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool CollisionSwitch
|
||||
{
|
||||
get
|
||||
{
|
||||
return _bCollisionSwitch;
|
||||
}
|
||||
set
|
||||
{
|
||||
_bCollisionSwitch = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CySpringParamDataAsset springData
|
||||
{
|
||||
set
|
||||
{
|
||||
_springData = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CySpringCollisionComponent[] CollisionList => _collisionList;
|
||||
|
||||
public float sqartDeltaTime => _sqartDeltaTime;
|
||||
|
||||
public CySpringRootBone[] boneList => _boneList;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
Create();
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_cachedTransform = base.gameObject.transform;
|
||||
SetCollision();
|
||||
Reset();
|
||||
}
|
||||
|
||||
private void Create()
|
||||
{
|
||||
_sqartDeltaTime = 0f;
|
||||
List<CySpringCollisionComponent> list = new List<CySpringCollisionComponent>(GetComponentsInChildren<CySpringCollisionComponent>());
|
||||
if (_springData == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (_lstUnionCollision != null && _bUseUnionCollision)
|
||||
{
|
||||
for (int i = 0; i < _lstUnionCollision.Count; i++)
|
||||
{
|
||||
CySpringCollisionComponent cySpringCollisionComponent = _lstUnionCollision[i];
|
||||
if (!list.Contains(cySpringCollisionComponent) && cySpringCollisionComponent != _unionCollision)
|
||||
{
|
||||
list.Add(cySpringCollisionComponent);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_unionCollision != null && list.Contains(_unionCollision))
|
||||
{
|
||||
list.Remove(_unionCollision);
|
||||
}
|
||||
if (_groundCollision != null && !list.Contains(_groundCollision))
|
||||
{
|
||||
list.Add(_groundCollision);
|
||||
}
|
||||
List<CySpringRootBone> list2 = new List<CySpringRootBone>();
|
||||
for (int j = 0; j < _springData.mergeDataList.Count; j++)
|
||||
{
|
||||
CySpringRootBone cySpringRootBone = new CySpringRootBone();
|
||||
cySpringRootBone.CreateRoot(_springData.mergeDataList[j], this, cySpringRootBone, null);
|
||||
if (cySpringRootBone.Exist)
|
||||
{
|
||||
list2.Add(cySpringRootBone);
|
||||
}
|
||||
}
|
||||
_boneList = list2.ToArray();
|
||||
_collisionList = list.ToArray();
|
||||
if (_nativeCollisions != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_nativeCollisions = new NativeClothCollision[_collisionList.Length];
|
||||
List<CollisionParent> list3 = new List<CollisionParent>(32);
|
||||
List<CySpringCollisionComponent> list4 = new List<CySpringCollisionComponent>(8);
|
||||
for (int k = 0; k < _collisionList.Length; k++)
|
||||
{
|
||||
CySpringCollisionComponent cySpringCollisionComponent2 = _collisionList[k];
|
||||
Transform parent = cySpringCollisionComponent2.transform.parent;
|
||||
int num = list3.FindIndex((CollisionParent x) => x.transform == parent);
|
||||
if (num < 0)
|
||||
{
|
||||
CollisionParent collisionParent = new CollisionParent();
|
||||
collisionParent.transform = parent;
|
||||
num = list3.Count;
|
||||
list3.Add(collisionParent);
|
||||
}
|
||||
if (cySpringCollisionComponent2.CollisionType == CySpringCollisionData.CollisionType.Sphere && cySpringCollisionComponent2.purpose == CySpringCollisionComponent.ePurpose.Union)
|
||||
{
|
||||
list4.Add(cySpringCollisionComponent2);
|
||||
}
|
||||
cySpringCollisionComponent2.SetNativeCollision(_nativeCollisions, k, num);
|
||||
}
|
||||
_collisionParentTable = list3.ToArray();
|
||||
_unionCollisionList = list4.ToArray();
|
||||
_collisionParentWorldPosition = new Vector3[list3.Count];
|
||||
_collisionParentWorldRotation = new Quaternion[list3.Count];
|
||||
}
|
||||
|
||||
private void SetCollision()
|
||||
{
|
||||
if (_boneList != null)
|
||||
{
|
||||
for (int i = 0; i < _boneList.Length; i++)
|
||||
{
|
||||
_boneList[i].SetCollision();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Reset(bool bForceReset = true)
|
||||
{
|
||||
if (_boneList != null && _boneList.Length != 0)
|
||||
{
|
||||
if (_cachedTransform == null)
|
||||
{
|
||||
_cachedTransform = base.gameObject.transform;
|
||||
}
|
||||
Vector3 position = _cachedTransform.transform.position;
|
||||
Quaternion rotation = _cachedTransform.transform.rotation;
|
||||
_cachedTransform.position = Vector3.zero;
|
||||
_cachedTransform.rotation = Quaternion.identity;
|
||||
for (int i = 0; i < _boneList.Length; i++)
|
||||
{
|
||||
_boneList[i].Reset(bForceReset);
|
||||
}
|
||||
_cachedTransform.position = position;
|
||||
_cachedTransform.rotation = rotation;
|
||||
}
|
||||
}
|
||||
|
||||
public static GameObject FindGameObject(GameObject rootObject, string objectName)
|
||||
{
|
||||
if (!objectName.Contains("/"))
|
||||
{
|
||||
return FindGameObjectLoop(rootObject, objectName);
|
||||
}
|
||||
string[] array = objectName.Split('/');
|
||||
if (array.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
GameObject gameObject = rootObject;
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
gameObject = FindGameObjectLoop(gameObject, array[i]);
|
||||
if (gameObject == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return gameObject;
|
||||
}
|
||||
|
||||
private static GameObject FindGameObjectLoop(GameObject rootObject, string objectName)
|
||||
{
|
||||
if (rootObject == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
foreach (Transform item in rootObject.transform)
|
||||
{
|
||||
if (item.name.Contains(objectName) && Array.IndexOf(IgnoreTransformName, item.name) < 0)
|
||||
{
|
||||
return item.gameObject;
|
||||
}
|
||||
}
|
||||
foreach (Transform item2 in rootObject.transform)
|
||||
{
|
||||
GameObject gameObject = FindGameObjectLoop(item2.gameObject, objectName);
|
||||
if (gameObject != null)
|
||||
{
|
||||
return gameObject;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7a0e7e54207c76e42aa64a93443f4e64
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,387 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CySpringBoneBase
|
||||
{
|
||||
protected string _boneName;
|
||||
|
||||
protected CySpring _root;
|
||||
|
||||
protected CySpringRootBone _rootBone;
|
||||
|
||||
protected CySpringBoneBase _parentBone;
|
||||
|
||||
protected GameObject _gameObject;
|
||||
|
||||
protected Transform _transform;
|
||||
|
||||
protected Transform _parentTransform;
|
||||
|
||||
protected bool _exist;
|
||||
|
||||
public int _index;
|
||||
|
||||
public CySpringParamDataChildElement _element;
|
||||
|
||||
private List<int> _collisionIndexList;
|
||||
|
||||
public string BoneName => _boneName;
|
||||
|
||||
public GameObject GameObject => _gameObject;
|
||||
|
||||
public float StiffnessForce => _rootBone._natives[_index]._stiffnessForce;
|
||||
|
||||
public float DragForce => _rootBone._natives[_index]._dragForce;
|
||||
|
||||
public Vector3 SpringForce => _rootBone._natives[_index]._springForce;
|
||||
|
||||
public float CollisionRadius => _rootBone._natives[_index]._collisionRadius;
|
||||
|
||||
public float Gravity => _rootBone._natives[_index]._gravity;
|
||||
|
||||
public CySpring.eCapability Capability => _rootBone._natives[_index]._capability;
|
||||
|
||||
public int CapsGroupIndex => _rootBone._natives[_index]._capsGroupIndex;
|
||||
|
||||
public float InitBoneDistance
|
||||
{
|
||||
get
|
||||
{
|
||||
return _rootBone._natives[_index]._initBoneDistance;
|
||||
}
|
||||
set
|
||||
{
|
||||
_rootBone._natives[_index]._initBoneDistance = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 BoneAxis
|
||||
{
|
||||
get
|
||||
{
|
||||
return _rootBone._natives[_index]._boneAxis;
|
||||
}
|
||||
set
|
||||
{
|
||||
_rootBone._natives[_index]._boneAxis = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Exist
|
||||
{
|
||||
get
|
||||
{
|
||||
return _exist;
|
||||
}
|
||||
set
|
||||
{
|
||||
_exist = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsWind
|
||||
{
|
||||
get
|
||||
{
|
||||
return (_rootBone._natives[_index]._wind & 1) != 0;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
_rootBone._natives[_index]._wind |= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
_rootBone._natives[_index]._wind &= -2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public float WindGroupIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _rootBone._natives[_index]._windGroupIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
_rootBone._natives[_index]._windGroupIndex = value;
|
||||
}
|
||||
}
|
||||
|
||||
public List<int> CollisionIndexList => _collisionIndexList;
|
||||
|
||||
public CySpringBoneBase()
|
||||
{
|
||||
}
|
||||
|
||||
public CySpringBoneBase(string name)
|
||||
{
|
||||
_boneName = name;
|
||||
}
|
||||
|
||||
public void Create(CySpring root, CySpringRootBone rootBone, CySpringBoneBase parentBone)
|
||||
{
|
||||
_root = root;
|
||||
_rootBone = rootBone;
|
||||
_parentBone = parentBone;
|
||||
_exist = false;
|
||||
if (!(_root == null) && _rootBone != null)
|
||||
{
|
||||
if (_parentBone != null)
|
||||
{
|
||||
_gameObject = CySpring.FindGameObject(_parentBone.GameObject, _boneName);
|
||||
}
|
||||
else
|
||||
{
|
||||
_gameObject = CySpring.FindGameObject(_root.gameObject, _boneName);
|
||||
}
|
||||
if (_gameObject == null)
|
||||
{
|
||||
_exist = false;
|
||||
return;
|
||||
}
|
||||
_transform = _gameObject.transform;
|
||||
_parentTransform = _transform.parent;
|
||||
_exist = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateChild(CySpring root, CySpringRootBone rootBone, CySpringBoneBase parentBone)
|
||||
{
|
||||
Create(root, rootBone, parentBone);
|
||||
foreach (Transform item in _transform)
|
||||
{
|
||||
if (!(item == _transform) && !(item.GetComponent<CySpringCollisionComponent>() != null))
|
||||
{
|
||||
CySpringBoneBase cySpringBoneBase = new CySpringBoneBase(item.name);
|
||||
_rootBone.TmpChildBoneList.Add(cySpringBoneBase);
|
||||
cySpringBoneBase.CreateChild(_root, _rootBone, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Initialize(int idx)
|
||||
{
|
||||
_index = idx;
|
||||
_rootBone._natives[_index]._initLocalRotation = _transform.localRotation;
|
||||
_rootBone._natives[_index]._currentPosition = _transform.position;
|
||||
_rootBone._natives[_index]._prevPosition = _rootBone._natives[_index]._currentPosition;
|
||||
_rootBone._natives[_index]._existCollision = _rootBone.ApplyCollision;
|
||||
if (_parentBone != null)
|
||||
{
|
||||
_parentBone.InitBoneDistance = Vector3.Distance(_transform.position, _parentBone.GameObject.transform.position);
|
||||
if (_parentBone.InitBoneDistance == 0f)
|
||||
{
|
||||
_parentBone.Exist = false;
|
||||
_exist = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
_parentBone.BoneAxis = (_gameObject.transform.position - _parentBone.GameObject.transform.position).normalized;
|
||||
}
|
||||
if (_transform.childCount == 0)
|
||||
{
|
||||
_rootBone._natives[_index]._boneAxis = _parentBone.BoneAxis;
|
||||
_rootBone._natives[_index]._initBoneDistance = _parentBone.InitBoneDistance;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_rootBone._natives[_index]._boneAxis = Vector3.down;
|
||||
_rootBone._natives[_index]._initBoneDistance = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateCollisionIndexList()
|
||||
{
|
||||
_collisionIndexList = new List<int>();
|
||||
_rootBone._natives[_index]._activeCollision = 0;
|
||||
}
|
||||
|
||||
protected void AddCollisionIndex(int i)
|
||||
{
|
||||
CollisionIndexList.Add(i);
|
||||
switch (_rootBone._natives[_index]._activeCollision)
|
||||
{
|
||||
case 0:
|
||||
_rootBone._natives[_index]._cIndex0 = (short)i;
|
||||
break;
|
||||
case 1:
|
||||
_rootBone._natives[_index]._cIndex1 = (short)i;
|
||||
break;
|
||||
case 2:
|
||||
_rootBone._natives[_index]._cIndex2 = (short)i;
|
||||
break;
|
||||
case 3:
|
||||
_rootBone._natives[_index]._cIndex3 = (short)i;
|
||||
break;
|
||||
case 4:
|
||||
_rootBone._natives[_index]._cIndex4 = (short)i;
|
||||
break;
|
||||
case 5:
|
||||
_rootBone._natives[_index]._cIndex5 = (short)i;
|
||||
break;
|
||||
case 6:
|
||||
_rootBone._natives[_index]._cIndex6 = (short)i;
|
||||
break;
|
||||
case 7:
|
||||
_rootBone._natives[_index]._cIndex7 = (short)i;
|
||||
break;
|
||||
case 8:
|
||||
_rootBone._natives[_index]._cIndex8 = (short)i;
|
||||
break;
|
||||
case 9:
|
||||
_rootBone._natives[_index]._cIndex9 = (short)i;
|
||||
break;
|
||||
case 10:
|
||||
_rootBone._natives[_index]._cIndex10 = (short)i;
|
||||
break;
|
||||
case 11:
|
||||
_rootBone._natives[_index]._cIndex11 = (short)i;
|
||||
break;
|
||||
case 12:
|
||||
_rootBone._natives[_index]._cIndex12 = (short)i;
|
||||
break;
|
||||
case 13:
|
||||
_rootBone._natives[_index]._cIndex13 = (short)i;
|
||||
break;
|
||||
case 14:
|
||||
_rootBone._natives[_index]._cIndex14 = (short)i;
|
||||
break;
|
||||
case 15:
|
||||
_rootBone._natives[_index]._cIndex15 = (short)i;
|
||||
break;
|
||||
case 16:
|
||||
_rootBone._natives[_index]._cIndex16 = (short)i;
|
||||
break;
|
||||
case 17:
|
||||
_rootBone._natives[_index]._cIndex17 = (short)i;
|
||||
break;
|
||||
case 18:
|
||||
_rootBone._natives[_index]._cIndex18 = (short)i;
|
||||
break;
|
||||
case 19:
|
||||
_rootBone._natives[_index]._cIndex19 = (short)i;
|
||||
break;
|
||||
}
|
||||
_rootBone._natives[_index]._activeCollision++;
|
||||
}
|
||||
|
||||
public void GatherSpring()
|
||||
{
|
||||
if (_root.sqartDeltaTime == 0f)
|
||||
{
|
||||
_transform.localRotation = _rootBone._natives[_index]._initLocalRotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
_rootBone._natives[_index]._existCollision = _rootBone.ApplyCollision;
|
||||
}
|
||||
}
|
||||
|
||||
public void DoGatherSpring()
|
||||
{
|
||||
_rootBone._natives[_index]._existCollision = _rootBone.ApplyCollision;
|
||||
}
|
||||
|
||||
public void DoGatherSpringReset()
|
||||
{
|
||||
_transform.localRotation = _rootBone._natives[_index]._initLocalRotation;
|
||||
}
|
||||
|
||||
public void PostSpring()
|
||||
{
|
||||
if (_root.sqartDeltaTime != 0f)
|
||||
{
|
||||
_transform.rotation = _rootBone._natives[_index]._finalRotation;
|
||||
}
|
||||
}
|
||||
|
||||
public void DoPostSpring()
|
||||
{
|
||||
_transform.rotation = _rootBone._natives[_index]._finalRotation;
|
||||
}
|
||||
|
||||
public virtual bool Reset(bool bForceReset = true)
|
||||
{
|
||||
if (_transform == null || (_rootBone._natives[_index]._gravity != 0f && !bForceReset))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
_transform.localRotation = _rootBone._natives[_index]._initLocalRotation;
|
||||
_rootBone._natives[_index]._oldPosition = _transform.position;
|
||||
_rootBone._natives[_index]._currentPosition = _rootBone._natives[_index]._diff * _rootBone._natives[_index]._initBoneDistance + _rootBone._natives[_index]._oldPosition;
|
||||
_rootBone._natives[_index]._oldRotation = _rootBone._natives[_index]._initLocalRotation * _parentTransform.rotation;
|
||||
_rootBone._natives[_index]._aimVector = _rootBone._natives[_index]._oldRotation * _rootBone._natives[_index]._boneAxis;
|
||||
_rootBone._natives[_index]._prevPosition = _rootBone._natives[_index]._currentPosition - _rootBone._natives[_index]._aimVector;
|
||||
_rootBone._natives[_index]._finalRotation = _transform.rotation;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void ChangeValue()
|
||||
{
|
||||
_rootBone._natives[_index]._existCollision = _rootBone.ApplyCollision;
|
||||
CreateCollisionIndexList();
|
||||
if (_rootBone.ChildElements != null)
|
||||
{
|
||||
string boneName = ((_index == 0) ? _boneName : _rootBone.ChildBoneList[_index - 1].BoneName);
|
||||
CySpringParamDataChildElement cySpringParamDataChildElement = (_element = _rootBone.ChildElements.Find((CySpringParamDataChildElement child) => child._boneName.Equals(boneName)));
|
||||
if (cySpringParamDataChildElement != null)
|
||||
{
|
||||
_rootBone._natives[_index]._stiffnessForce = cySpringParamDataChildElement._stiffnessForce;
|
||||
_rootBone._natives[_index]._dragForce = cySpringParamDataChildElement._dragForce;
|
||||
_rootBone._natives[_index]._springForce = cySpringParamDataChildElement._springForce;
|
||||
_rootBone._natives[_index]._collisionRadius = cySpringParamDataChildElement._collisionRadius;
|
||||
_rootBone._natives[_index]._gravity = cySpringParamDataChildElement._gravity;
|
||||
if (cySpringParamDataChildElement._collisionNameList == null || cySpringParamDataChildElement._collisionNameList.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (string collisionName in cySpringParamDataChildElement._collisionNameList)
|
||||
{
|
||||
int i = 0;
|
||||
for (int num = _root.CollisionList.Length; i < num; i++)
|
||||
{
|
||||
CySpringCollisionComponent cySpringCollisionComponent = _root.CollisionList[i];
|
||||
if (!(cySpringCollisionComponent == null) && !(collisionName != cySpringCollisionComponent.name))
|
||||
{
|
||||
AddCollisionIndex((short)i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
_element = null;
|
||||
_rootBone._natives[_index]._stiffnessForce = _rootBone.StiffnessForce;
|
||||
_rootBone._natives[_index]._dragForce = _rootBone.DragForce;
|
||||
_rootBone._natives[_index]._springForce = _rootBone.SpringForce;
|
||||
_rootBone._natives[_index]._collisionRadius = _rootBone.CollisionRadius;
|
||||
_rootBone._natives[_index]._gravity = _rootBone.Gravity;
|
||||
if (_rootBone.CollisionIndexList != null)
|
||||
{
|
||||
for (int j = 0; j < _rootBone.CollisionIndexList.Count; j++)
|
||||
{
|
||||
AddCollisionIndex(_rootBone.CollisionIndexList[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void ResetClothParameter()
|
||||
{
|
||||
if (_element == null)
|
||||
{
|
||||
_rootBone._natives[_index]._stiffnessForce = _rootBone.StiffnessForce;
|
||||
_rootBone._natives[_index]._dragForce = _rootBone.DragForce;
|
||||
_rootBone._natives[_index]._gravity = _rootBone.Gravity;
|
||||
}
|
||||
else
|
||||
{
|
||||
_rootBone._natives[_index]._stiffnessForce = _element._stiffnessForce;
|
||||
_rootBone._natives[_index]._dragForce = _element._dragForce;
|
||||
_rootBone._natives[_index]._gravity = _element._gravity;
|
||||
}
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7dc0b77b59037104396dc81e3c2103a7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
-187
@@ -1,187 +0,0 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
public class CySpringCollisionComponent : MonoBehaviour
|
||||
{
|
||||
public enum ePurpose
|
||||
{
|
||||
None = 0,
|
||||
Generic = 1,
|
||||
Union = 2,
|
||||
Ground = 4
|
||||
}
|
||||
|
||||
[NonSerialized]
|
||||
public float _radius;
|
||||
|
||||
[SerializeField]
|
||||
private CySpringCollisionData.CollisionType _collisionType;
|
||||
|
||||
private Vector3 _offset = new Vector3(0f, 0f, 0f);
|
||||
|
||||
private Vector3 _offset2 = new Vector3(0f, 0f, 0f);
|
||||
|
||||
private Transform _cacheTransform;
|
||||
|
||||
private ePurpose _purpose = ePurpose.Generic;
|
||||
|
||||
private Vector3 _unionCollisionPosition = Vector3.zero;
|
||||
|
||||
private int _nativeIndex;
|
||||
|
||||
private NativeClothCollision[] _nativeClothCollision;
|
||||
|
||||
public float Radius
|
||||
{
|
||||
get
|
||||
{
|
||||
return _radius;
|
||||
}
|
||||
set
|
||||
{
|
||||
_radius = value;
|
||||
}
|
||||
}
|
||||
|
||||
public CySpringCollisionData.CollisionType CollisionType
|
||||
{
|
||||
get
|
||||
{
|
||||
return _collisionType;
|
||||
}
|
||||
set
|
||||
{
|
||||
_collisionType = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 Offset
|
||||
{
|
||||
get
|
||||
{
|
||||
return _offset;
|
||||
}
|
||||
set
|
||||
{
|
||||
_offset = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 Offset2
|
||||
{
|
||||
get
|
||||
{
|
||||
return _offset2;
|
||||
}
|
||||
set
|
||||
{
|
||||
_offset2 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Vector3 Rotation
|
||||
{
|
||||
get
|
||||
{
|
||||
return _offset2;
|
||||
}
|
||||
set
|
||||
{
|
||||
_offset2 = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Transform cacheTransform => _cacheTransform;
|
||||
|
||||
public Vector3 unionCollisionPosition => _unionCollisionPosition;
|
||||
|
||||
public ePurpose purpose
|
||||
{
|
||||
get
|
||||
{
|
||||
return _purpose;
|
||||
}
|
||||
set
|
||||
{
|
||||
_purpose = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_cacheTransform = GetComponent<Transform>();
|
||||
}
|
||||
|
||||
public void UpdateUnionCollision()
|
||||
{
|
||||
_unionCollisionPosition = _cacheTransform.position;
|
||||
}
|
||||
|
||||
public void EnableUnionCollision(bool bEnable)
|
||||
{
|
||||
_collisionType = ((!bEnable) ? CySpringCollisionData.CollisionType.None : CySpringCollisionData.CollisionType.Sphere);
|
||||
}
|
||||
|
||||
private void UpdateNativeParameter()
|
||||
{
|
||||
if (_nativeClothCollision == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (CollisionType)
|
||||
{
|
||||
case CySpringCollisionData.CollisionType.Sphere:
|
||||
switch (purpose)
|
||||
{
|
||||
case ePurpose.Ground:
|
||||
{
|
||||
Vector3 offset = Offset;
|
||||
offset.y -= _radius;
|
||||
_nativeClothCollision[_nativeIndex]._position = offset;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
_nativeClothCollision[_nativeIndex]._position = Offset;
|
||||
break;
|
||||
case ePurpose.Union:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case CySpringCollisionData.CollisionType.Capsule:
|
||||
if (_cacheTransform != null)
|
||||
{
|
||||
_nativeClothCollision[_nativeIndex]._position = Vector3.Scale(Offset, _cacheTransform.lossyScale);
|
||||
_nativeClothCollision[_nativeIndex]._position2 = Vector3.Scale(Offset2, _cacheTransform.lossyScale);
|
||||
}
|
||||
else
|
||||
{
|
||||
_nativeClothCollision[_nativeIndex]._position = Vector3.Scale(Offset, base.transform.lossyScale);
|
||||
_nativeClothCollision[_nativeIndex]._position2 = Vector3.Scale(Offset2, base.transform.lossyScale);
|
||||
}
|
||||
break;
|
||||
case CySpringCollisionData.CollisionType.None:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateNativeUnionCollision(ref Vector3 rootPosition, ref Quaternion rootRotation)
|
||||
{
|
||||
if (CollisionType == CySpringCollisionData.CollisionType.Sphere && purpose == ePurpose.Union)
|
||||
{
|
||||
Vector3 vector = unionCollisionPosition - rootPosition;
|
||||
vector = Quaternion.Inverse(rootRotation) * vector;
|
||||
_nativeClothCollision[_nativeIndex]._position = vector;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetNativeCollision(NativeClothCollision[] collision, int index, int parentIndex)
|
||||
{
|
||||
_nativeIndex = index;
|
||||
_nativeClothCollision = collision;
|
||||
_nativeClothCollision[index]._radius = Radius;
|
||||
_nativeClothCollision[index]._type = (int)CollisionType;
|
||||
_nativeClothCollision[index]._purpose = (int)purpose;
|
||||
_nativeClothCollision[index]._parentIndex = parentIndex;
|
||||
UpdateNativeParameter();
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c022ec9f5374f9a4e94479946adba685
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,213 +0,0 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
public struct CySpringNative
|
||||
{
|
||||
private const string LibraryName = "CySpringPlugin";
|
||||
|
||||
public static bool isNative = true;
|
||||
|
||||
public NativeClothWorking _clothWorking;
|
||||
|
||||
[DllImport("CySpringPlugin")]
|
||||
private static extern void NativeClothUpdate(IntPtr cond, int nCond, IntPtr collisions, IntPtr clothParams, IntPtr parentWorldPosition, IntPtr parentWorldRotation);
|
||||
/*
|
||||
private unsafe static void UpdateNativeClothInternal(NativeClothWorking[] clothWorking, NativeClothCollision[] collisions, NativeClothParameter[] clothParam, Vector3[] parentWorldPosition, Quaternion[] parentWorldRotation)
|
||||
{
|
||||
int nCond = clothWorking.Length;
|
||||
fixed (NativeClothWorking* ptr = &clothWorking[0])
|
||||
{
|
||||
fixed (NativeClothCollision* ptr2 = collisions)
|
||||
{
|
||||
fixed (NativeClothParameter* ptr3 = &clothParam[0])
|
||||
{
|
||||
fixed (Vector3* ptr4 = parentWorldPosition)
|
||||
{
|
||||
fixed (Quaternion* ptr5 = parentWorldRotation)
|
||||
{
|
||||
NativeClothUpdate((IntPtr)ptr, nCond, (IntPtr)ptr2, (IntPtr)ptr3, (IntPtr)ptr4, (IntPtr)ptr5);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
public static void UpdateNativeCloth(NativeClothWorking[] clothWorkings, NativeClothCollision[] collisions, NativeClothParameter[] clothParam, Vector3[] parentCollisionWorldPosition, Quaternion[] _collisionParentWorldRotation)
|
||||
{
|
||||
if (clothWorkings[0]._isSkip)
|
||||
{
|
||||
return;
|
||||
}
|
||||
int num = clothWorkings.Length;
|
||||
|
||||
/* Native(dll)による物理演算は無効化
|
||||
if (isNative)
|
||||
{
|
||||
UpdateNativeClothInternal(clothWorkings, collisions, clothParam, parentCollisionWorldPosition, _collisionParentWorldRotation);
|
||||
return;
|
||||
}
|
||||
*/
|
||||
|
||||
for (int i = 1; i < num; i++)
|
||||
{
|
||||
clothWorkings[i]._oldPosition = clothWorkings[i - 1]._currentPosition;
|
||||
clothWorkings[i]._oldRotation = clothWorkings[i]._initLocalRotation * clothWorkings[i - 1]._finalRotation;
|
||||
}
|
||||
for (int j = 0; j < num; j++)
|
||||
{
|
||||
UpdateNativeClothInternalMono(ref clothWorkings[j], collisions, ref clothParam[0], parentCollisionWorldPosition, _collisionParentWorldRotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void UpdateNativeClothInternalMono(ref NativeClothWorking clothWorking, NativeClothCollision[] collisions, ref NativeClothParameter clothParam, Vector3[] parentWorldPosition, Quaternion[] parentWorldRotation)
|
||||
{
|
||||
clothWorking._diff = clothWorking._prevPosition - clothWorking._currentPosition;
|
||||
clothWorking._prevPosition = clothWorking._currentPosition;
|
||||
clothWorking._aimVector = clothWorking._oldRotation * clothWorking._boneAxis;
|
||||
clothWorking._force = clothWorking._aimVector * clothWorking._stiffnessForce * clothParam._stiffnessForceRate;
|
||||
clothWorking._force += clothWorking._diff * clothWorking._dragForce * clothParam._dragForceRate;
|
||||
clothWorking._force += clothWorking._springForce;
|
||||
if ((clothWorking._capability & CySpring.eCapability.GravityControl) != 0)
|
||||
{
|
||||
bool flag = false;
|
||||
Vector3 vector = Vector3.down;
|
||||
switch (clothWorking._capsGroupIndex)
|
||||
{
|
||||
case 0:
|
||||
flag = (clothParam._capability0 & CySpring.eCapability.GravityControl) != 0;
|
||||
vector = clothParam._gravityDirection0;
|
||||
break;
|
||||
case 1:
|
||||
flag = (clothParam._capability1 & CySpring.eCapability.GravityControl) != 0;
|
||||
vector = clothParam._gravityDirection1;
|
||||
break;
|
||||
case 2:
|
||||
flag = (clothParam._capability2 & CySpring.eCapability.GravityControl) != 0;
|
||||
vector = clothParam._gravityDirection2;
|
||||
break;
|
||||
case 3:
|
||||
flag = (clothParam._capability3 & CySpring.eCapability.GravityControl) != 0;
|
||||
vector = clothParam._gravityDirection3;
|
||||
break;
|
||||
case 4:
|
||||
flag = (clothParam._capability4 & CySpring.eCapability.GravityControl) != 0;
|
||||
vector = clothParam._gravityDirection4;
|
||||
break;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
float num = clothWorking._gravity * clothParam._gravityRate;
|
||||
vector = clothWorking._oldRotation * vector * num;
|
||||
clothWorking._force -= vector;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
clothWorking._force.y -= clothWorking._gravity * clothParam._gravityRate;
|
||||
}
|
||||
if (((uint)clothWorking._wind & (true ? 1u : 0u)) != 0)
|
||||
{
|
||||
clothWorking._force = Vector3.Scale(clothWorking._force, clothParam._forceScale);
|
||||
clothWorking._force += clothWorking._windPower;
|
||||
}
|
||||
clothWorking._currentPosition = clothWorking._currentPosition - clothWorking._diff + clothWorking._force;
|
||||
clothWorking._diff = (clothWorking._currentPosition - clothWorking._oldPosition).normalized;
|
||||
clothWorking._currentPosition = clothWorking._diff * clothWorking._initBoneDistance + clothWorking._oldPosition;
|
||||
if (clothWorking._existCollision && clothWorking._activeCollision > 0 && clothParam._collisionSwitch)
|
||||
{
|
||||
int[] array = new int[20]
|
||||
{
|
||||
clothWorking._cIndex0, clothWorking._cIndex1, clothWorking._cIndex2, clothWorking._cIndex3, clothWorking._cIndex4, clothWorking._cIndex5, clothWorking._cIndex6, clothWorking._cIndex7, clothWorking._cIndex8, clothWorking._cIndex9,
|
||||
clothWorking._cIndex10, clothWorking._cIndex11, clothWorking._cIndex12, clothWorking._cIndex13, clothWorking._cIndex14, clothWorking._cIndex15, clothWorking._cIndex16, clothWorking._cIndex17, clothWorking._cIndex18, clothWorking._cIndex19
|
||||
};
|
||||
for (int i = 0; i < clothWorking._activeCollision; i++)
|
||||
{
|
||||
int num2 = array[i];
|
||||
NativeClothCollision nativeClothCollision = collisions[num2];
|
||||
int parentIndex = nativeClothCollision._parentIndex;
|
||||
Vector3 vector2;
|
||||
Vector3 vector3;
|
||||
switch (nativeClothCollision._type)
|
||||
{
|
||||
default:
|
||||
vector2 = Vector3.zero;
|
||||
vector3 = clothWorking._currentPosition;
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
Vector3 vector11;
|
||||
Vector3 vector4;
|
||||
if (nativeClothCollision._purpose == 2)
|
||||
{
|
||||
vector11 = nativeClothCollision._position;
|
||||
vector3 = clothWorking._currentPosition;
|
||||
vector4 = clothWorking._oldPosition;
|
||||
vector2 = Vector3.zero;
|
||||
}
|
||||
else
|
||||
{
|
||||
vector2 = parentWorldPosition[parentIndex];
|
||||
vector3 = clothWorking._currentPosition - vector2;
|
||||
vector4 = clothWorking._oldPosition - vector2;
|
||||
vector11 = parentWorldRotation[parentIndex] * nativeClothCollision._position;
|
||||
}
|
||||
if (Vector3.Distance(vector3, vector11) <= clothWorking._collisionRadius + nativeClothCollision._radius)
|
||||
{
|
||||
Vector3 normalized3 = (vector3 - vector11).normalized;
|
||||
vector3 = vector11 + normalized3 * (clothWorking._collisionRadius + nativeClothCollision._radius);
|
||||
vector3 = (vector3 - vector4).normalized * clothWorking._initBoneDistance + vector4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
vector2 = parentWorldPosition[parentIndex];
|
||||
vector3 = clothWorking._currentPosition - vector2;
|
||||
Vector3 vector4 = clothWorking._oldPosition - vector2;
|
||||
Vector3 vector5 = parentWorldRotation[parentIndex] * nativeClothCollision._position;
|
||||
Vector3 vector6 = parentWorldRotation[parentIndex] * nativeClothCollision._position2;
|
||||
Vector3 vector7 = vector6 - vector5;
|
||||
float magnitude = vector7.magnitude;
|
||||
vector7 /= magnitude;
|
||||
Vector3 vector8 = vector3 - vector5;
|
||||
float num3 = Vector3.Dot(vector8, vector7);
|
||||
bool flag2 = false;
|
||||
if (0f <= num3 && num3 < magnitude)
|
||||
{
|
||||
Vector3 vector9 = vector7 * num3;
|
||||
Vector3 vector10 = vector8 - vector9;
|
||||
float magnitude2 = vector10.magnitude;
|
||||
if (magnitude2 < clothWorking._collisionRadius + nativeClothCollision._radius)
|
||||
{
|
||||
vector3 = vector5 + vector9 + vector10 * ((clothWorking._collisionRadius + nativeClothCollision._radius) / magnitude2);
|
||||
vector3 = (vector3 - vector4).normalized * clothWorking._initBoneDistance + vector4;
|
||||
flag2 = true;
|
||||
}
|
||||
}
|
||||
if (!flag2)
|
||||
{
|
||||
if (Vector3.Distance(vector3, vector5) <= clothWorking._collisionRadius + nativeClothCollision._radius)
|
||||
{
|
||||
Vector3 normalized = (vector3 - vector5).normalized;
|
||||
vector3 = vector5 + normalized * (clothWorking._collisionRadius + nativeClothCollision._radius);
|
||||
vector3 = (vector3 - vector4).normalized * clothWorking._initBoneDistance + vector4;
|
||||
}
|
||||
else if (Vector3.Distance(vector3, vector6) <= clothWorking._collisionRadius + nativeClothCollision._radius)
|
||||
{
|
||||
Vector3 normalized2 = (vector3 - vector6).normalized;
|
||||
vector3 = vector6 + normalized2 * (clothWorking._collisionRadius + nativeClothCollision._radius);
|
||||
vector3 = (vector3 - vector4).normalized * clothWorking._initBoneDistance + vector4;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
clothWorking._currentPosition = vector3 + vector2;
|
||||
}
|
||||
}
|
||||
clothWorking._finalRotation = Quaternion.FromToRotation(clothWorking._aimVector, clothWorking._diff) * clothWorking._oldRotation;
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4a68b14e3f18fc348a25777b6947480d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
-55
@@ -1,55 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CySpringParamDataAsset : ScriptableObject
|
||||
{
|
||||
[SerializeField]
|
||||
private List<CySpringParamDataElement> _elements;
|
||||
|
||||
[SerializeField]
|
||||
private List<CySpringPartsParamDataElement> _partsElements;
|
||||
|
||||
[NonSerialized]
|
||||
private List<CySpringParamDataElement> _mergedDataList = new List<CySpringParamDataElement>();
|
||||
|
||||
public List<CySpringParamDataElement> elements
|
||||
{
|
||||
get
|
||||
{
|
||||
return _elements;
|
||||
}
|
||||
set
|
||||
{
|
||||
_elements = value;
|
||||
}
|
||||
}
|
||||
|
||||
public List<CySpringParamDataElement> mergeDataList => _mergedDataList;
|
||||
|
||||
public void Build(List<string> lstPartsCode)
|
||||
{
|
||||
Dictionary<string, CySpringPartsParamDataElement> dictionary = new Dictionary<string, CySpringPartsParamDataElement>();
|
||||
foreach (CySpringPartsParamDataElement partsElement in _partsElements)
|
||||
{
|
||||
if (!dictionary.ContainsKey(partsElement.partsCode))
|
||||
{
|
||||
dictionary.Add(partsElement.partsCode, partsElement);
|
||||
}
|
||||
}
|
||||
_mergedDataList.Clear();
|
||||
_mergedDataList.AddRange(_elements);
|
||||
if (lstPartsCode == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (string item in lstPartsCode)
|
||||
{
|
||||
CySpringPartsParamDataElement value = null;
|
||||
if (dictionary.TryGetValue(item, out value) && value.valid)
|
||||
{
|
||||
_mergedDataList.AddRange(value.elements);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a39c84902a07e1745a1b4e7a49f90a50
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
[Serializable]
|
||||
public class CySpringPartsParamDataElement
|
||||
{
|
||||
[SerializeField]
|
||||
private string _partsCode = string.Empty;
|
||||
|
||||
[SerializeField]
|
||||
private List<CySpringParamDataElement> _elements;
|
||||
|
||||
public string partsCode => _partsCode;
|
||||
|
||||
public List<CySpringParamDataElement> elements
|
||||
{
|
||||
get
|
||||
{
|
||||
return _elements;
|
||||
}
|
||||
set
|
||||
{
|
||||
_elements = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool valid
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Character3DBase.Parts.IsValidPartsCode(_partsCode))
|
||||
{
|
||||
if (_elements != null)
|
||||
{
|
||||
return _elements.Count > 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5bc0eecfbe3d2134e81a42eda62ac8b7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,357 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class CySpringRootBone : CySpringBoneBase
|
||||
{
|
||||
public struct OverrideParameter
|
||||
{
|
||||
public bool enableGravity;
|
||||
|
||||
public float gravity;
|
||||
|
||||
public bool enableStiffness;
|
||||
|
||||
public float stiffness;
|
||||
|
||||
public bool enableDragForce;
|
||||
|
||||
public float dragForce;
|
||||
}
|
||||
|
||||
public const float DefaultSuppressionLength = 1f;
|
||||
|
||||
public List<string> _collisionNameList;
|
||||
|
||||
private List<CySpringParamDataChildElement> _childElements;
|
||||
|
||||
private int _depth;
|
||||
|
||||
private List<CySpringBoneBase> _tmpChildBoneList;
|
||||
|
||||
private CySpringBoneBase[] _childBoneList;
|
||||
|
||||
private CySpringParamDataElement _rootElement;
|
||||
|
||||
private bool _isRootElement;
|
||||
|
||||
private bool _isSuppression;
|
||||
|
||||
private float _suppressionLength = 1f;
|
||||
|
||||
private bool _applyCollision = true;
|
||||
|
||||
public NativeClothWorking[] _natives;
|
||||
|
||||
protected bool _hasOftenAccessedParent;
|
||||
|
||||
public bool _isSkip;
|
||||
|
||||
public bool ApplyCollision => _applyCollision;
|
||||
|
||||
public List<CySpringParamDataChildElement> ChildElements => _childElements;
|
||||
|
||||
public CySpringBoneBase[] ChildBoneList => _childBoneList;
|
||||
|
||||
public bool IsSuppression
|
||||
{
|
||||
get
|
||||
{
|
||||
return _isSuppression;
|
||||
}
|
||||
set
|
||||
{
|
||||
_isSuppression = value;
|
||||
}
|
||||
}
|
||||
|
||||
public float SuppressionLength
|
||||
{
|
||||
get
|
||||
{
|
||||
return _suppressionLength;
|
||||
}
|
||||
set
|
||||
{
|
||||
_suppressionLength = value;
|
||||
}
|
||||
}
|
||||
|
||||
public List<CySpringBoneBase> TmpChildBoneList => _tmpChildBoneList;
|
||||
|
||||
public void CreateRoot(CySpringParamDataElement element, CySpring root, CySpringRootBone rootBone, CySpringBoneBase parentBone)
|
||||
{
|
||||
_boneName = element._boneName;
|
||||
_collisionNameList = element._collisionNameList;
|
||||
_childElements = element._childElements;
|
||||
_rootElement = element;
|
||||
_isRootElement = _rootElement != null;
|
||||
Transform transform = root.gameObject.transform;
|
||||
Vector3 position = transform.position;
|
||||
Quaternion rotation = transform.rotation;
|
||||
transform.position = Vector3.zero;
|
||||
transform.rotation = Quaternion.identity;
|
||||
Create(root, rootBone, parentBone);
|
||||
if (!_exist)
|
||||
{
|
||||
transform.position = position;
|
||||
transform.rotation = rotation;
|
||||
return;
|
||||
}
|
||||
_tmpChildBoneList = new List<CySpringBoneBase>();
|
||||
foreach (Transform item in _transform)
|
||||
{
|
||||
if (!(item == _transform) && !(item.GetComponent<CySpringCollisionComponent>() != null))
|
||||
{
|
||||
CySpringBoneBase cySpringBoneBase = new CySpringBoneBase(item.name);
|
||||
_tmpChildBoneList.Add(cySpringBoneBase);
|
||||
cySpringBoneBase.CreateChild(_root, _rootBone, this);
|
||||
}
|
||||
}
|
||||
_childBoneList = _tmpChildBoneList.ToArray();
|
||||
_tmpChildBoneList = null;
|
||||
_depth = _childBoneList.Length;
|
||||
_natives = new NativeClothWorking[_childBoneList.Length + 1];
|
||||
for (int i = 0; i < _natives.Length; i++)
|
||||
{
|
||||
_natives[i]._stiffnessForce = 0.0001f;
|
||||
_natives[i]._dragForce = 0.05f;
|
||||
_natives[i]._springForce = new Vector3(0f, 0f, 0f);
|
||||
_natives[i]._collisionRadius = 0.01f;
|
||||
_natives[i]._boneAxis = new Vector3(0f, 1f, 0f);
|
||||
_natives[i]._gravity = 0f;
|
||||
_natives[i]._wind = 0;
|
||||
_natives[i]._windGroupIndex = 0f;
|
||||
}
|
||||
Initialize(0);
|
||||
for (int j = 0; j < _childBoneList.Length; j++)
|
||||
{
|
||||
_childBoneList[j].Initialize(j + 1);
|
||||
}
|
||||
_natives[0]._stiffnessForce = element._stiffnessForce;
|
||||
_natives[0]._dragForce = element._dragForce;
|
||||
_natives[0]._springForce = element._springForce;
|
||||
_natives[0]._collisionRadius = element._collisionRadius;
|
||||
_natives[0]._gravity = element._gravity;
|
||||
_natives[0]._capability = element._capability;
|
||||
_natives[0]._capsGroupIndex = element._capsGroupIndex;
|
||||
transform.position = position;
|
||||
transform.rotation = rotation;
|
||||
}
|
||||
|
||||
public bool CheckHasOftenAccessedParent(string oftenAccessedParent)
|
||||
{
|
||||
_hasOftenAccessedParent = false;
|
||||
if (_parentTransform != null && _parentTransform.name.Equals(oftenAccessedParent))
|
||||
{
|
||||
_hasOftenAccessedParent = true;
|
||||
}
|
||||
return _hasOftenAccessedParent;
|
||||
}
|
||||
|
||||
private void UpdateCollisionIndexList()
|
||||
{
|
||||
if (_collisionNameList == null || _collisionNameList.Count == 0 || _root.CollisionList == null || _root.CollisionList.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
CreateCollisionIndexList();
|
||||
foreach (string collisionName in _collisionNameList)
|
||||
{
|
||||
int i = 0;
|
||||
for (int num = _root.CollisionList.Length; i < num; i++)
|
||||
{
|
||||
CySpringCollisionComponent cySpringCollisionComponent = _root.CollisionList[i];
|
||||
if (!(cySpringCollisionComponent == null) && !(collisionName != cySpringCollisionComponent.name))
|
||||
{
|
||||
AddCollisionIndex(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetCollision()
|
||||
{
|
||||
UpdateCollisionIndexList();
|
||||
ChangeRootValue();
|
||||
}
|
||||
|
||||
public void DoGatherAllSpring(ref Quaternion oftenAccessedParentRot)
|
||||
{
|
||||
if (_depth < 0)
|
||||
{
|
||||
_isSkip = true;
|
||||
return;
|
||||
}
|
||||
_isSkip = false;
|
||||
UpdateNativeOldTransform(ref oftenAccessedParentRot);
|
||||
DoGatherSpring();
|
||||
CySpringBoneBase[] childBoneList = _childBoneList;
|
||||
for (int i = 0; i < childBoneList.Length; i++)
|
||||
{
|
||||
childBoneList[i].DoGatherSpring();
|
||||
}
|
||||
}
|
||||
|
||||
public void DoGatherAllSpringReset(ref Quaternion oftenAccessedParentRot)
|
||||
{
|
||||
if (_depth < 0)
|
||||
{
|
||||
_isSkip = true;
|
||||
return;
|
||||
}
|
||||
_isSkip = false;
|
||||
UpdateNativeOldTransform(ref oftenAccessedParentRot);
|
||||
DoGatherSpringReset();
|
||||
CySpringBoneBase[] childBoneList = _childBoneList;
|
||||
for (int i = 0; i < childBoneList.Length; i++)
|
||||
{
|
||||
childBoneList[i].DoGatherSpringReset();
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateNativeOldTransform(ref Quaternion oftenAccessedParentRot)
|
||||
{
|
||||
Vector3 position = _transform.position;
|
||||
if (_hasOftenAccessedParent)
|
||||
{
|
||||
_rootBone._natives[_index]._oldRotation = oftenAccessedParentRot * _rootBone._natives[_index]._initLocalRotation;
|
||||
}
|
||||
else
|
||||
{
|
||||
_rootBone._natives[_index]._oldRotation = _parentTransform.rotation * _rootBone._natives[_index]._initLocalRotation;
|
||||
}
|
||||
if (_isSuppression)
|
||||
{
|
||||
Vector3 vector = position - _rootBone._natives[_index]._oldPosition;
|
||||
float sqrMagnitude = vector.sqrMagnitude;
|
||||
if (sqrMagnitude >= _suppressionLength + float.Epsilon)
|
||||
{
|
||||
float num = 0.01f;
|
||||
if (sqrMagnitude < 0.0001f)
|
||||
{
|
||||
num = Mathf.Sqrt(sqrMagnitude);
|
||||
vector.x /= num;
|
||||
vector.y /= num;
|
||||
vector.z /= num;
|
||||
}
|
||||
else
|
||||
{
|
||||
vector.Normalize();
|
||||
}
|
||||
_rootBone._natives[_index]._currentPosition = position;
|
||||
_rootBone._natives[_index]._prevPosition = position - vector * num;
|
||||
_rootBone._natives[_index]._finalRotation = _rootBone._natives[_index]._oldRotation;
|
||||
for (int i = 1; i < _rootBone._natives.Length; i++)
|
||||
{
|
||||
_rootBone._natives[i]._currentPosition = _rootBone._natives[i - 1]._currentPosition;
|
||||
_rootBone._natives[i]._prevPosition = _rootBone._natives[i - 1]._prevPosition;
|
||||
_rootBone._natives[i]._finalRotation = _rootBone._natives[i - 1]._finalRotation;
|
||||
}
|
||||
}
|
||||
_suppressionLength = 1f;
|
||||
}
|
||||
_rootBone._natives[_index]._oldPosition = position;
|
||||
}
|
||||
|
||||
public void DoPostAllSpring()
|
||||
{
|
||||
DoPostSpring();
|
||||
CySpringBoneBase[] childBoneList = _childBoneList;
|
||||
for (int i = 0; i < childBoneList.Length; i++)
|
||||
{
|
||||
childBoneList[i].DoPostSpring();
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Reset(bool bForceReset = true)
|
||||
{
|
||||
if (base.Reset(bForceReset))
|
||||
{
|
||||
if (_childBoneList == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
CySpringBoneBase[] childBoneList = _childBoneList;
|
||||
for (int i = 0; i < childBoneList.Length; i++)
|
||||
{
|
||||
childBoneList[i].Reset(bForceReset);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void ChangeRootValue()
|
||||
{
|
||||
if (_childBoneList != null)
|
||||
{
|
||||
_rootBone._natives[_index]._existCollision = _rootBone._applyCollision;
|
||||
CySpringBoneBase[] childBoneList = _childBoneList;
|
||||
for (int i = 0; i < childBoneList.Length; i++)
|
||||
{
|
||||
childBoneList[i].ChangeValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void ResetClothParameter()
|
||||
{
|
||||
if (_isRootElement)
|
||||
{
|
||||
_natives[0]._stiffnessForce = _rootElement._stiffnessForce;
|
||||
_natives[0]._dragForce = _rootElement._dragForce;
|
||||
_natives[0]._gravity = _rootElement._gravity;
|
||||
int num = _childBoneList.Length;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
_childBoneList[i].ResetClothParameter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OverrideClothParameter(ref OverrideParameter overrideParameter)
|
||||
{
|
||||
if (!_isRootElement)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (overrideParameter.enableStiffness)
|
||||
{
|
||||
_natives[0]._stiffnessForce = overrideParameter.stiffness;
|
||||
}
|
||||
if (overrideParameter.enableDragForce)
|
||||
{
|
||||
_natives[0]._dragForce = overrideParameter.dragForce;
|
||||
}
|
||||
if (overrideParameter.enableGravity)
|
||||
{
|
||||
_natives[0]._gravity = overrideParameter.gravity;
|
||||
}
|
||||
int num = _childBoneList.Length;
|
||||
for (int i = 0; i < num; i++)
|
||||
{
|
||||
int index = _childBoneList[i]._index;
|
||||
if (overrideParameter.enableStiffness)
|
||||
{
|
||||
_natives[index]._stiffnessForce = overrideParameter.stiffness;
|
||||
}
|
||||
if (overrideParameter.enableDragForce)
|
||||
{
|
||||
_natives[index]._dragForce = overrideParameter.dragForce;
|
||||
}
|
||||
if (overrideParameter.enableGravity)
|
||||
{
|
||||
_natives[index]._gravity = overrideParameter.gravity;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void GetWindGroupIndex(ref float index)
|
||||
{
|
||||
index = _natives[0]._windGroupIndex;
|
||||
}
|
||||
|
||||
public void UpdateWindPower(Vector3 windPower)
|
||||
{
|
||||
_natives[0]._windPower = windPower;
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5257c19392246cc4a9e45cfdd09c1cd1
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
namespace Gallop
|
||||
{
|
||||
// Asset bundles reference this original qualified signature. The recovered implementation
|
||||
// lives in the global namespace, so inherit it to preserve all serialized collision fields.
|
||||
public class CySpringCollisionComponent : global::CySpringCollisionComponent
|
||||
{
|
||||
}
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9459a406c0ff58349bd3255f1827c124
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct NativeClothCollision
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Vector3 _position;
|
||||
|
||||
[FieldOffset(16)]
|
||||
public Vector3 _position2;
|
||||
|
||||
[FieldOffset(32)]
|
||||
public int _type;
|
||||
|
||||
[FieldOffset(36)]
|
||||
public float _radius;
|
||||
|
||||
[FieldOffset(40)]
|
||||
public int _parentIndex;
|
||||
|
||||
[FieldOffset(44)]
|
||||
public int _purpose;
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f765d160eded774489ce5bf9df880700
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
-51
@@ -1,51 +0,0 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct NativeClothParameter
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public float _stiffnessForceRate;
|
||||
|
||||
[FieldOffset(4)]
|
||||
public float _dragForceRate;
|
||||
|
||||
[FieldOffset(8)]
|
||||
public float _gravityRate;
|
||||
|
||||
[FieldOffset(12)]
|
||||
public bool _collisionSwitch;
|
||||
|
||||
[FieldOffset(16)]
|
||||
public CySpring.eCapability _capability0;
|
||||
|
||||
[FieldOffset(20)]
|
||||
public CySpring.eCapability _capability1;
|
||||
|
||||
[FieldOffset(24)]
|
||||
public CySpring.eCapability _capability2;
|
||||
|
||||
[FieldOffset(28)]
|
||||
public CySpring.eCapability _capability3;
|
||||
|
||||
[FieldOffset(32)]
|
||||
public CySpring.eCapability _capability4;
|
||||
|
||||
[FieldOffset(36)]
|
||||
public Vector3 _gravityDirection0;
|
||||
|
||||
[FieldOffset(52)]
|
||||
public Vector3 _gravityDirection1;
|
||||
|
||||
[FieldOffset(68)]
|
||||
public Vector3 _gravityDirection2;
|
||||
|
||||
[FieldOffset(84)]
|
||||
public Vector3 _gravityDirection3;
|
||||
|
||||
[FieldOffset(100)]
|
||||
public Vector3 _gravityDirection4;
|
||||
|
||||
[FieldOffset(116)]
|
||||
public Vector3 _forceScale;
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8c5b73284409b904c9e354466553b5fc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
-138
@@ -1,138 +0,0 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using UnityEngine;
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
public struct NativeClothWorking
|
||||
{
|
||||
[FieldOffset(0)]
|
||||
public Quaternion _initLocalRotation;
|
||||
|
||||
[FieldOffset(16)]
|
||||
public Quaternion _oldRotation;
|
||||
|
||||
[FieldOffset(32)]
|
||||
public Quaternion _finalRotation;
|
||||
|
||||
[FieldOffset(48)]
|
||||
public Vector3 _boneAxis;
|
||||
|
||||
[FieldOffset(64)]
|
||||
public Vector3 _currentPosition;
|
||||
|
||||
[FieldOffset(80)]
|
||||
public Vector3 _prevPosition;
|
||||
|
||||
[FieldOffset(96)]
|
||||
public Vector3 _force;
|
||||
|
||||
[FieldOffset(112)]
|
||||
public Vector3 _aimVector;
|
||||
|
||||
[FieldOffset(128)]
|
||||
public Vector3 _diff;
|
||||
|
||||
[FieldOffset(144)]
|
||||
public Vector3 _oldPosition;
|
||||
|
||||
[FieldOffset(160)]
|
||||
public Vector3 _springForce;
|
||||
|
||||
[FieldOffset(176)]
|
||||
public Vector3 _windPower;
|
||||
|
||||
[FieldOffset(192)]
|
||||
public float _initBoneDistance;
|
||||
|
||||
[FieldOffset(196)]
|
||||
public float _stiffnessForce;
|
||||
|
||||
[FieldOffset(200)]
|
||||
public float _dragForce;
|
||||
|
||||
[FieldOffset(204)]
|
||||
public float _collisionRadius;
|
||||
|
||||
[FieldOffset(208)]
|
||||
public float _gravity;
|
||||
|
||||
[FieldOffset(212)]
|
||||
public int _activeCollision;
|
||||
|
||||
[FieldOffset(216)]
|
||||
public short _cIndex0;
|
||||
|
||||
[FieldOffset(218)]
|
||||
public short _cIndex1;
|
||||
|
||||
[FieldOffset(220)]
|
||||
public short _cIndex2;
|
||||
|
||||
[FieldOffset(222)]
|
||||
public short _cIndex3;
|
||||
|
||||
[FieldOffset(224)]
|
||||
public short _cIndex4;
|
||||
|
||||
[FieldOffset(226)]
|
||||
public short _cIndex5;
|
||||
|
||||
[FieldOffset(228)]
|
||||
public short _cIndex6;
|
||||
|
||||
[FieldOffset(230)]
|
||||
public short _cIndex7;
|
||||
|
||||
[FieldOffset(232)]
|
||||
public short _cIndex8;
|
||||
|
||||
[FieldOffset(234)]
|
||||
public short _cIndex9;
|
||||
|
||||
[FieldOffset(236)]
|
||||
public short _cIndex10;
|
||||
|
||||
[FieldOffset(238)]
|
||||
public short _cIndex11;
|
||||
|
||||
[FieldOffset(240)]
|
||||
public short _cIndex12;
|
||||
|
||||
[FieldOffset(242)]
|
||||
public short _cIndex13;
|
||||
|
||||
[FieldOffset(244)]
|
||||
public short _cIndex14;
|
||||
|
||||
[FieldOffset(246)]
|
||||
public short _cIndex15;
|
||||
|
||||
[FieldOffset(248)]
|
||||
public short _cIndex16;
|
||||
|
||||
[FieldOffset(250)]
|
||||
public short _cIndex17;
|
||||
|
||||
[FieldOffset(252)]
|
||||
public short _cIndex18;
|
||||
|
||||
[FieldOffset(254)]
|
||||
public short _cIndex19;
|
||||
|
||||
[FieldOffset(256)]
|
||||
public bool _existCollision;
|
||||
|
||||
[FieldOffset(260)]
|
||||
public bool _isSkip;
|
||||
|
||||
[FieldOffset(264)]
|
||||
public CySpring.eCapability _capability;
|
||||
|
||||
[FieldOffset(268)]
|
||||
public int _capsGroupIndex;
|
||||
|
||||
[FieldOffset(272)]
|
||||
public int _wind;
|
||||
|
||||
[FieldOffset(276)]
|
||||
public float _windGroupIndex;
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b654867abd24c914faf9229e6e508ba3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,153 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class LiveTimelineCamera : MonoBehaviour
|
||||
{
|
||||
private bool _applyNoise = true;
|
||||
|
||||
public float positionFrequency = 0.2f;
|
||||
|
||||
public float rotationFrequency = 0.2f;
|
||||
|
||||
public float positionAmount = kPositionAmountInitVal;
|
||||
|
||||
public float rotationAmount = kRotationAmountInitVal;
|
||||
|
||||
public Vector3 positionComponents = kPositionComponentsInitVal;
|
||||
|
||||
public Vector3 rotationComponents = kRotationComponentsInitVal;
|
||||
|
||||
private int positionOctave = 2;
|
||||
|
||||
private int rotationOctave = 2;
|
||||
|
||||
private float timePosition;
|
||||
|
||||
private float timeRotation;
|
||||
|
||||
private float initTimePosition;
|
||||
|
||||
private float initTimeRotation;
|
||||
|
||||
private Vector2[] noiseVectors;
|
||||
|
||||
private Camera _attachedCamera;
|
||||
|
||||
private Vector3 posOffset = Vector3.zero;
|
||||
|
||||
private Quaternion rotOffset = Quaternion.identity;
|
||||
|
||||
public bool applyNoise
|
||||
{
|
||||
get
|
||||
{
|
||||
return _applyNoise;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (_applyNoise != value && attachedCamera != null)
|
||||
{
|
||||
attachedCamera.ResetWorldToCameraMatrix();
|
||||
}
|
||||
_applyNoise = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static float kPositionAmountInitVal
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0f;
|
||||
}
|
||||
}
|
||||
|
||||
public static float kRotationAmountInitVal
|
||||
{
|
||||
get
|
||||
{
|
||||
return 3f;
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector3 kPositionComponentsInitVal
|
||||
{
|
||||
get
|
||||
{
|
||||
return Vector3.one;
|
||||
}
|
||||
}
|
||||
|
||||
public static Vector3 kRotationComponentsInitVal
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Vector3(1f, 1f, 0f);
|
||||
}
|
||||
}
|
||||
|
||||
private Camera attachedCamera
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_attachedCamera == null)
|
||||
{
|
||||
_attachedCamera = GetComponent<Camera>();
|
||||
}
|
||||
return _attachedCamera;
|
||||
}
|
||||
}
|
||||
|
||||
public void AlterAwake()
|
||||
{
|
||||
applyNoise = false;
|
||||
initTimePosition = Random.value * 10f;
|
||||
initTimeRotation = Random.value * 10f;
|
||||
noiseVectors = new Vector2[6];
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
float f = Random.value * 3.14159274f * 2f;
|
||||
noiseVectors[i].Set(Mathf.Cos(f), Mathf.Sin(f));
|
||||
}
|
||||
}
|
||||
|
||||
public void AlterUpdate(float liveTime)
|
||||
{
|
||||
if (attachedCamera.isActiveAndEnabled && applyNoise)
|
||||
{
|
||||
timePosition = initTimePosition + liveTime * positionFrequency;
|
||||
timeRotation = initTimeRotation + liveTime * rotationFrequency;
|
||||
if (positionAmount != 0f)
|
||||
{
|
||||
Vector3 a = new Vector3(Fbm(noiseVectors[0] * timePosition, positionOctave), Fbm(noiseVectors[1] * timePosition, positionOctave), Fbm(noiseVectors[2] * timePosition, positionOctave));
|
||||
a = (posOffset = Vector3.Scale(a, positionComponents) * positionAmount * 2f);
|
||||
}
|
||||
if (rotationAmount != 0f)
|
||||
{
|
||||
Vector3 a2 = new Vector3(Fbm(noiseVectors[3] * timeRotation, rotationOctave), Fbm(noiseVectors[4] * timeRotation, rotationOctave), Fbm(noiseVectors[5] * timeRotation, rotationOctave));
|
||||
a2 = Vector3.Scale(a2, rotationComponents) * rotationAmount * 2f;
|
||||
rotOffset = Quaternion.Euler(a2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static float Fbm(Vector2 coord, int octave)
|
||||
{
|
||||
float num = 0f;
|
||||
float num2 = 1f;
|
||||
for (int i = 0; i < octave; i++)
|
||||
{
|
||||
num += num2 * (Mathf.PerlinNoise(coord.x, coord.y) - 0.5f);
|
||||
coord *= 2f;
|
||||
num2 *= 0.5f;
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
private void OnPreCull()
|
||||
{
|
||||
if (!(attachedCamera == null) && attachedCamera.isActiveAndEnabled && applyNoise)
|
||||
{
|
||||
Matrix4x4 lhs = Matrix4x4.TRS(posOffset, rotOffset, new Vector3(1f, 1f, -1f));
|
||||
attachedCamera.worldToCameraMatrix = lhs * attachedCamera.transform.worldToLocalMatrix;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4a2660e6623c754d831671b41d6e562
|
||||
timeCreated: 1534933914
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,100 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Stage
|
||||
{
|
||||
public class StageUtil
|
||||
{
|
||||
public static Vector2 GetRenderTargetResolution()
|
||||
{
|
||||
return new Vector2(Screen.width, Screen.height);
|
||||
}
|
||||
|
||||
|
||||
public static Vector2 GetQuarterResolution()
|
||||
{
|
||||
Vector2 renderTargetResolution = GetRenderTargetResolution();
|
||||
float x = renderTargetResolution.x * 0.25f;
|
||||
float y = renderTargetResolution.y * 0.25f;
|
||||
return new Vector2(x, y);
|
||||
}
|
||||
|
||||
public static Vector2 CalcRTResolution(float fWidth)
|
||||
{
|
||||
Vector2 renderTargetResolution = GetRenderTargetResolution();
|
||||
float num = renderTargetResolution.x / renderTargetResolution.y;
|
||||
float y = fWidth / num;
|
||||
return new Vector2(fWidth, y);
|
||||
}
|
||||
|
||||
public static int LayerToCullingMask(StageLayers layer)
|
||||
{
|
||||
return 1 << (int)layer;
|
||||
}
|
||||
|
||||
|
||||
public enum StageLayers
|
||||
{
|
||||
Default = 0,
|
||||
TransparentFX = 1,
|
||||
IgnoreRaycast = 2,
|
||||
Dummy1 = 3,
|
||||
Water = 4,
|
||||
UI = 5,
|
||||
Dummy2 = 6,
|
||||
Dummy3 = 7,
|
||||
Background = 8,
|
||||
BG = 9,
|
||||
Dummy4 = 10,
|
||||
Room = 11,
|
||||
RoomUI = 12,
|
||||
MiniGame = 13,
|
||||
AR = 14,
|
||||
DebugUI = 0xF,
|
||||
Dummy6 = 0x10,
|
||||
Dummy7 = 17,
|
||||
Background3D_Other = 18,
|
||||
Background3D_NotReflect = 19,
|
||||
Background3d = 20,
|
||||
Character3d = 21,
|
||||
Character3d_0 = 22,
|
||||
Character3d_1 = 23,
|
||||
Character3d_2 = 24,
|
||||
Character3d_3 = 25,
|
||||
Character3d_4 = 26,
|
||||
Character3D_NotReflect = 27,
|
||||
MultiCameraMask = 28,
|
||||
A2U = 29,
|
||||
LiveNGUI = 30,
|
||||
Loading = 0x1F,
|
||||
CharacterRealtimeShadow = 10
|
||||
}
|
||||
|
||||
public static int CharaAllLayers()
|
||||
{
|
||||
int layers = 0;
|
||||
layers |= 1 << (int)StageLayers.Character3d;
|
||||
layers |= 1 << (int)StageLayers.Character3d_0;
|
||||
layers |= 1 << (int)StageLayers.Character3d_1;
|
||||
layers |= 1 << (int)StageLayers.Character3d_2;
|
||||
layers |= 1 << (int)StageLayers.Character3d_3;
|
||||
layers |= 1 << (int)StageLayers.Character3d_4;
|
||||
layers |= 1 << (int)StageLayers.Character3D_NotReflect;
|
||||
|
||||
return layers;
|
||||
//return 266338304;
|
||||
}
|
||||
|
||||
public static int Background3dAllLayers()
|
||||
{
|
||||
int layers = 0;
|
||||
layers |= 1 << (int)StageLayers.Background3d;
|
||||
layers |= 1 << (int)StageLayers.Background3D_NotReflect;
|
||||
layers |= 1 << (int)StageLayers.Background3D_Other;
|
||||
|
||||
return layers;
|
||||
//return 1835008;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8a530bade3aafd4695c5819993a7a78
|
||||
timeCreated: 1535265710
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user