浏览代码

Assorted changes

- Added buoy manager to lower cost of buoys
- One particle system for all buoys
- Added windsurfer manager to lower cost of windsurfers
- Added level bound colliders
- fixed GC alloc on boat buoyantobject
/demo-work
André McGrail 5 年前
当前提交
64853ed9
共有 18 个文件被更改,包括 2585 次插入1314 次删除
  1. 104
      Assets/Objects/Levels/Island/Dynamic Objects.prefab
  2. 992
      Assets/Objects/Levels/Island/Environment Objects Prefabs/Props_Floating.prefab
  3. 70
      Assets/Objects/Levels/Island/Environment Objects.prefab
  4. 9
      Assets/Objects/Levels/Island/Island Level.prefab
  5. 166
      Assets/Objects/Levels/Island/Logic.prefab
  6. 311
      Assets/Objects/props/props/Prefabs/Arrow.prefab
  7. 992
      Assets/Objects/props/props/Prefabs/Buoy.prefab
  8. 39
      Assets/Objects/props/props/Prefabs/Windsurfer.prefab
  9. 14
      Assets/Scripts/Boat/Engine.cs
  10. 37
      Assets/Scripts/Environment/BuoyManager.cs
  11. 2
      Assets/Scripts/Environment/WindsurferManager.cs.meta
  12. 992
      Assets/scenes/Island.unity
  13. 30
      Packages/com.verasl.water-system/Scripts/BuoyantObject.cs
  14. 2
      Packages/com.verasl.water-system/Scripts/GerstnerWavesJobs.cs
  15. 34
      Packages/com.verasl.water-system/Scripts/LocalToWorldJob.cs
  16. 63
      Assets/Scripts/Environment/WindsurferManager.cs
  17. 42
      Assets/Scripts/Environment/WindsurferLogic.cs
  18. 0
      /Assets/Scripts/Environment/WindsurferManager.cs.meta

104
Assets/Objects/Levels/Island/Dynamic Objects.prefab


m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3691299465910115698}
m_LocalRotation: {x: 0.0037227138, y: -0.5582595, z: 0.0025049474, w: 0.8296543}
m_LocalPosition: {x: -126.25647, y: 26.723148, z: -42.830765}
m_LocalRotation: {x: 0.0037202202, y: -0.5582551, z: 0.0025032402, w: 0.82965726}
m_LocalPosition: {x: -126.25714, y: 26.723145, z: -42.830498}
m_LocalScale: {x: 1.0000002, y: 1, z: 1}
m_Children:
- {fileID: 3687029360008883863}

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3691299466218782728}
m_LocalRotation: {x: 0.07513669, y: 0.44232956, z: -0.037220605, w: 0.89292425}
m_LocalPosition: {x: 61.425903, y: 22.726093, z: 4.972809}
m_LocalRotation: {x: 0.075143576, y: 0.44248784, z: -0.037240665, w: 0.89284444}
m_LocalPosition: {x: 61.39312, y: 22.733078, z: 4.9478455}
m_LocalScale: {x: 0.9999999, y: 0.9999999, z: 1}
m_Children:
- {fileID: 3687029361275514629}

serializedVersion: 6
m_Component:
- component: {fileID: 3691299467046892349}
- component: {fileID: 7445508610064726706}
m_Layer: 0
m_Name: Windsurfers
m_TagString: Untagged

m_Father: {fileID: 3691299466235561722}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7445508610064726706
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3691299467046892348}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 23313225b48b84cc8ba0722dd9f5b25d, type: 3}
m_Name:
m_EditorClassIdentifier:
surfers:
- {fileID: 3686919769996966123}
- {fileID: 3686919771259669492}
- {fileID: 3686919770998924310}
- {fileID: 3686919769527619485}
- {fileID: 3686919769447922815}
- {fileID: 3686919769569603137}
- {fileID: 3686919770442601851}
- {fileID: 3686919771342485412}
- {fileID: 3686919769563647087}
- {fileID: 3686919769970301350}
--- !u!1 &3691299467085645504
GameObject:
m_ObjectHideFlags: 0

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3691299467085645504}
m_LocalRotation: {x: 0.04506648, y: 0.7262534, z: -0.047830928, w: 0.6842787}
m_LocalPosition: {x: 93.90462, y: 16.68996, z: 22.234848}
m_LocalRotation: {x: 0.04515341, y: 0.7257085, z: -0.047847304, w: 0.6848496}
m_LocalPosition: {x: 93.87082, y: 16.694439, z: 22.236816}
m_LocalScale: {x: 1, y: 0.9999999, z: 1}
m_Children:
- {fileID: 3687029361035548319}

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3691299467367477595}
m_LocalRotation: {x: 0.04561324, y: 0.42304733, z: -0.021329062, w: 0.90470743}
m_LocalPosition: {x: -140.34204, y: 31.509968, z: 6.4324646}
m_LocalRotation: {x: 0.045619424, y: 0.42306006, z: -0.021332743, w: 0.90470105}
m_LocalPosition: {x: -140.33954, y: 31.50964, z: 6.434555}
m_LocalScale: {x: 0.9999999, y: 0.9999999, z: 1}
m_Children:
- {fileID: 3687029360349540377}

m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3691299467484457467}
m_LocalRotation: {x: 0.14142378, y: -0.33732703, z: 0.0513362, w: 0.929287}
m_LocalPosition: {x: 60.54671, y: 64.178314, z: -142.72514}
m_LocalRotation: {x: 0.1413816, y: -0.3374391, z: 0.05133984, w: 0.92925256}
m_LocalPosition: {x: 60.55375, y: 64.18173, z: -142.73357}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3687029360019781275}

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71, type: 3}
--- !u!4 &3686919769563647087 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4697876554718994, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,
type: 3}
m_PrefabInstance: {fileID: 3691299465941668733}
m_PrefabAsset: {fileID: 0}
--- !u!4 &3686802486986155575 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4510310561805642, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,

type: 3}
m_PrefabInstance: {fileID: 3691299465952604499}
m_PrefabAsset: {fileID: 0}
--- !u!4 &3686919769569603137 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4697876554718994, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,
type: 3}
m_PrefabInstance: {fileID: 3691299465952604499}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &3691299465977729167
PrefabInstance:
m_ObjectHideFlags: 0

type: 3}
m_PrefabInstance: {fileID: 3691299465977729167}
m_PrefabAsset: {fileID: 0}
--- !u!4 &3686919769527619485 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4697876554718994, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,
type: 3}
m_PrefabInstance: {fileID: 3691299465977729167}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &3691299466065797997
PrefabInstance:
m_ObjectHideFlags: 0

type: 3}
m_PrefabInstance: {fileID: 3691299466065797997}
m_PrefabAsset: {fileID: 0}
--- !u!4 &3686919769447922815 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4697876554718994, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,
type: 3}
m_PrefabInstance: {fileID: 3691299466065797997}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &3691299466202715199
PrefabInstance:
m_ObjectHideFlags: 0

type: 3}
m_PrefabInstance: {fileID: 3691299466582075385}
m_PrefabAsset: {fileID: 0}
--- !u!4 &3686919769996966123 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4697876554718994, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,
type: 3}
m_PrefabInstance: {fileID: 3691299466582075385}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &3691299466617276084
PrefabInstance:
m_ObjectHideFlags: 0

type: 3}
m_PrefabInstance: {fileID: 3691299466617276084}
m_PrefabAsset: {fileID: 0}
--- !u!4 &3686919769970301350 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4697876554718994, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,
type: 3}
m_PrefabInstance: {fileID: 3691299466617276084}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &3691299466637129811
PrefabInstance:
m_ObjectHideFlags: 0

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71, type: 3}
--- !u!4 &3686919770442601851 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4697876554718994, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,
type: 3}
m_PrefabInstance: {fileID: 3691299467226942057}
m_PrefabAsset: {fileID: 0}
--- !u!4 &3686802488255217443 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4510310561805642, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,

type: 3}
m_PrefabInstance: {fileID: 3691299467384170678}
m_PrefabAsset: {fileID: 0}
--- !u!4 &3686919771342485412 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4697876554718994, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,
type: 3}
m_PrefabInstance: {fileID: 3691299467384170678}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &3691299467475162342
PrefabInstance:
m_ObjectHideFlags: 0

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71, type: 3}
--- !u!4 &3686919771259669492 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4697876554718994, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,
type: 3}
m_PrefabInstance: {fileID: 3691299467475162342}
m_PrefabAsset: {fileID: 0}
--- !u!4 &3686802488510308780 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4510310561805642, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,

objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71, type: 3}
--- !u!4 &3686919770998924310 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4697876554718994, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,
type: 3}
m_PrefabInstance: {fileID: 3691299467752864516}
m_PrefabAsset: {fileID: 0}
--- !u!4 &3686802488769613390 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 4510310561805642, guid: cb2fae9bfdf2e44f6a5973fccdc7cf71,

992
Assets/Objects/Levels/Island/Environment Objects Prefabs/Props_Floating.prefab
文件差异内容过多而无法显示
查看文件

70
Assets/Objects/Levels/Island/Environment Objects.prefab


m_Modification:
m_TransformParent: {fileID: 132011064864940600}
m_Modifications:
- target: {fileID: 3759085506645941870, guid: 36042d8ccb0039d4cbf9a33c03d3b163,
type: 3}
propertyPath: m_Name
value: Props_Floating
objectReference: {fileID: 0}
- target: {fileID: 3759085506645941871, guid: 36042d8ccb0039d4cbf9a33c03d3b163,
type: 3}
propertyPath: m_LocalPosition.x

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3759085506645941870, guid: 36042d8ccb0039d4cbf9a33c03d3b163,
type: 3}
propertyPath: m_Name
value: Props_Floating
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 36042d8ccb0039d4cbf9a33c03d3b163, type: 3}
--- !u!4 &211174324478074584 stripped

m_Modification:
m_TransformParent: {fileID: 132011064864940600}
m_Modifications:
- target: {fileID: 3882959527817565178, guid: d2dc6490ece255c4c9c2edeef61afe5a,
type: 3}
propertyPath: m_Name
value: Env_Bush
objectReference: {fileID: 0}
- target: {fileID: 3882959527817565181, guid: d2dc6490ece255c4c9c2edeef61afe5a,
type: 3}
propertyPath: m_LocalPosition.x

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3882959527817565178, guid: d2dc6490ece255c4c9c2edeef61afe5a,
type: 3}
propertyPath: m_Name
value: Env_Bush
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: d2dc6490ece255c4c9c2edeef61afe5a, type: 3}
--- !u!4 &211174323967300113 stripped

m_Modification:
m_TransformParent: {fileID: 132011064864940600}
m_Modifications:
- target: {fileID: 4154829702800552442, guid: f2fff4894cc3a1d4aaaeff4416bdca27,
type: 3}
propertyPath: m_Name
value: Buildings
objectReference: {fileID: 0}
- target: {fileID: 4154829702800552445, guid: f2fff4894cc3a1d4aaaeff4416bdca27,
type: 3}
propertyPath: m_LocalPosition.x

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4154829702800552442, guid: f2fff4894cc3a1d4aaaeff4416bdca27,
type: 3}
propertyPath: m_Name
value: Buildings
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f2fff4894cc3a1d4aaaeff4416bdca27, type: 3}
--- !u!4 &211174324748872857 stripped

m_Modification:
m_TransformParent: {fileID: 132011064864940600}
m_Modifications:
- target: {fileID: 5469468814475710585, guid: 85a71e3b547f7c442a158fa957c6530e,
type: 3}
propertyPath: m_Name
value: Env_Seaweed
objectReference: {fileID: 0}
- target: {fileID: 5469468814475710586, guid: 85a71e3b547f7c442a158fa957c6530e,
type: 3}
propertyPath: m_LocalPosition.x

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5469468814475710585, guid: 85a71e3b547f7c442a158fa957c6530e,
type: 3}
propertyPath: m_Name
value: Env_Seaweed
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 85a71e3b547f7c442a158fa957c6530e, type: 3}
--- !u!4 &211174323778763063 stripped

m_Modification:
m_TransformParent: {fileID: 132011064864940600}
m_Modifications:
- target: {fileID: 5511751451176667084, guid: 15aac945ccfbbed4a944b129e74580d7,
type: 3}
propertyPath: m_Name
value: Env_BushCards
objectReference: {fileID: 0}
- target: {fileID: 5511751451176667085, guid: 15aac945ccfbbed4a944b129e74580d7,
type: 3}
propertyPath: m_LocalPosition.x

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5511751451176667084, guid: 15aac945ccfbbed4a944b129e74580d7,
type: 3}
propertyPath: m_Name
value: Env_BushCards
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 15aac945ccfbbed4a944b129e74580d7, type: 3}
--- !u!4 &211174323225527182 stripped

m_Modification:
m_TransformParent: {fileID: 132011064864940600}
m_Modifications:
- target: {fileID: 6307525649040309357, guid: 65d8a7ab23f067a44aa705ef9002dc4f,
type: 3}
propertyPath: m_Name
value: Env_Trees
objectReference: {fileID: 0}
- target: {fileID: 6307525649040309356, guid: 65d8a7ab23f067a44aa705ef9002dc4f,
type: 3}
propertyPath: m_LocalPosition.x

propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6307525649040309357, guid: 65d8a7ab23f067a44aa705ef9002dc4f,
type: 3}
propertyPath: m_Name
value: Env_Trees
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 65d8a7ab23f067a44aa705ef9002dc4f, type: 3}
--- !u!4 &211174324586434472 stripped

m_Modification:
m_TransformParent: {fileID: 132011064864940600}
m_Modifications:
- target: {fileID: 7896972405519639226, guid: e63ab1f2df5ccec448925e349377792c,
type: 3}
propertyPath: m_Name
value: Env_Rocks
objectReference: {fileID: 0}
- target: {fileID: 7896972405519639227, guid: e63ab1f2df5ccec448925e349377792c,
type: 3}
propertyPath: m_LocalPosition.x

type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7896972405519639226, guid: e63ab1f2df5ccec448925e349377792c,
type: 3}
propertyPath: m_Name
value: Env_Rocks
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e63ab1f2df5ccec448925e349377792c, type: 3}

9
Assets/Objects/Levels/Island/Island Level.prefab


propertyPath: m_Name
value: Lighting
objectReference: {fileID: 0}
- target: {fileID: 543646049902552566, guid: af7e3352382514479b91bf48c1e8f88e,
type: 3}
propertyPath: m_Intensity
value: 5
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: af7e3352382514479b91bf48c1e8f88e, type: 3}
--- !u!4 &6589000189763280055 stripped

- target: {fileID: 3691299467085645505, guid: 344be8fa397804294b1b2f63976790a9,
type: 3}
propertyPath: m_LocalRotation.y
value: 0.7262534
value: 0.7257085
value: 0.6842787
value: 0.6848496
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 344be8fa397804294b1b2f63976790a9, type: 3}

166
Assets/Objects/Levels/Island/Logic.prefab


%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1027376447158747114
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4233294543437945176}
- component: {fileID: 7401198662849869679}
m_Layer: 0
m_Name: Wall
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4233294543437945176
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1027376447158747114}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 160.7, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2343824943627837844}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &7401198662849869679
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1027376447158747114}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 10, y: 80, z: 250}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &5076232290459243463
GameObject:
m_ObjectHideFlags: 0

- {fileID: 5076232291228677031}
- {fileID: 7924522256525669911}
- {fileID: 1956725784267945688}
- {fileID: 2343824943627837844}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

m_PositionOffset: 0
m_SearchRadius: 3
m_SearchResolution: 5
--- !u!1 &6187911570451958519
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7220004121617269956}
- component: {fileID: 8910916800249713710}
m_Layer: 0
m_Name: Wall (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7220004121617269956
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6187911570451958519}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -150, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2343824943627837844}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &8910916800249713710
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6187911570451958519}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 10, y: 80, z: 250}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &6273923786888198228
GameObject:
m_ObjectHideFlags: 0

roll: 0
- position: {x: 118.93849, y: -3.0683866, z: -27.979568}
roll: 0
--- !u!1 &6587431711960133509
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2343824943627837844}
m_Layer: 0
m_Name: LevelBounds
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2343824943627837844
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6587431711960133509}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4233294543437945176}
- {fileID: 7220004121617269956}
- {fileID: 8841334385287172059}
m_Father: {fileID: 5076232292041737951}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7010826786460218321
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8841334385287172059}
- component: {fileID: 1522781926648767702}
m_Layer: 0
m_Name: Wall (2)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &8841334385287172059
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7010826786460218321}
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 5, y: 0, z: 120}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2343824943627837844}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
--- !u!65 &1522781926648767702
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7010826786460218321}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 10, y: 80, z: 320}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &8351381251499836217
GameObject:
m_ObjectHideFlags: 0

311
Assets/Objects/props/props/Prefabs/Arrow.prefab


- component: {fileID: 4299416875123572}
- component: {fileID: 64253283233661102}
- component: {fileID: 5568153857360384074}
- component: {fileID: 1401221890254571561}
- component: {fileID: 1209638207773308205}
m_Layer: 0
m_Name: ArrowSign
m_TagString: Untagged

renderers:
- renderer: {fileID: 6054106052659713031}
m_Enabled: 1
--- !u!199 &1401221890254571561
--- !u!1 &1358110382548184
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4531681947286508}
- component: {fileID: 114368991022472188}
m_Layer: 0
m_Name: Arrow
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4531681947286508
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1358110382548184}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -73, y: 0, z: -53.6}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4299416875123572}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114368991022472188
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1358110382548184}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3d5ac9593b59d4847815e4528b52a6d2, type: 3}
m_Name:
m_EditorClassIdentifier:
_buoyancyType: 0
density: 0
volume: 1
voxelResolution: 0.51
centerOfMass: {x: 0, y: 0, z: 0}
waterLevelOffset: 0
voxels: []
colliders:
- {fileID: 0}
percentSubmerged: 0
--- !u!1 &57836401027674839
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5357552133296375944}
- component: {fileID: 8155192640840471879}
- component: {fileID: 3799474459916824563}
- component: {fileID: 1528313417933914168}
- component: {fileID: 1897400866408744944}
- component: {fileID: 8338273565263367771}
m_Layer: 0
m_Name: Geo_Props_ArrowSign_LOD0
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 1
m_IsActive: 1
--- !u!4 &5357552133296375944
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 57836401027674839}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4299416875123572}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &8155192640840471879
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 57836401027674839}
m_Mesh: {fileID: 4300026, guid: 92a669df93f0d4f99bd8fa27767e8c9e, type: 3}
--- !u!23 &3799474459916824563
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 57836401027674839}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 3
m_RayTracingMode: 2
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: b1aaf92c06be94931a4e515a4812f42e, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 2
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!64 &1528313417933914168
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 57836401027674839}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 3
m_Convex: 1
m_CookingOptions: 14
m_Mesh: {fileID: 4300014, guid: 92a669df93f0d4f99bd8fa27767e8c9e, type: 3}
--- !u!199 &1897400866408744944
ParticleSystemRenderer:
serializedVersion: 6
m_ObjectHideFlags: 0

m_GameObject: {fileID: 1279828893496440}
m_GameObject: {fileID: 57836401027674839}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0

m_Mesh2: {fileID: 0}
m_Mesh3: {fileID: 0}
m_MaskInteraction: 0
--- !u!198 &1209638207773308205
--- !u!198 &8338273565263367771
m_GameObject: {fileID: 1279828893496440}
m_GameObject: {fileID: 57836401027674839}
lengthInSec: 5
lengthInSec: 2
simulationSpeed: 1
stopAction: 0
cullingMode: 0

prewarm: 0
prewarm: 1
playOnAwake: 1
useUnscaledTime: 0
autoRandomSeed: 1

m_PostInfinity: 2
m_RotationOrder: 4
vectorLabel1_3: W
--- !u!1 &1358110382548184
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4531681947286508}
- component: {fileID: 114368991022472188}
m_Layer: 0
m_Name: Arrow
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4531681947286508
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1358110382548184}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -73, y: 0, z: -53.6}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4299416875123572}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &114368991022472188
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1358110382548184}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3d5ac9593b59d4847815e4528b52a6d2, type: 3}
m_Name:
m_EditorClassIdentifier:
_buoyancyType: 0
density: 0
volume: 1
voxelResolution: 0.51
centerOfMass: {x: 0, y: 0, z: 0}
voxels: []
colliders:
- {fileID: 0}
percentSubmerged: 0
--- !u!1 &57836401027674839
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5357552133296375944}
- component: {fileID: 8155192640840471879}
- component: {fileID: 3799474459916824563}
- component: {fileID: 1528313417933914168}
m_Layer: 0
m_Name: Geo_Props_ArrowSign_LOD0
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 1
m_IsActive: 1
--- !u!4 &5357552133296375944
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 57836401027674839}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4299416875123572}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &8155192640840471879
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 57836401027674839}
m_Mesh: {fileID: 4300026, guid: 92a669df93f0d4f99bd8fa27767e8c9e, type: 3}
--- !u!23 &3799474459916824563
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 57836401027674839}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 3
m_RayTracingMode: 2
m_RenderingLayerMask: 4294967295
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: b1aaf92c06be94931a4e515a4812f42e, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 2
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!64 &1528313417933914168
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 57836401027674839}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 3
m_Convex: 1
m_CookingOptions: 14
m_Mesh: {fileID: 4300014, guid: 92a669df93f0d4f99bd8fa27767e8c9e, type: 3}
--- !u!1 &6075304680604880651
GameObject:
m_ObjectHideFlags: 0

992
Assets/Objects/props/props/Prefabs/Buoy.prefab
文件差异内容过多而无法显示
查看文件

39
Assets/Objects/props/props/Prefabs/Windsurfer.prefab


serializedVersion: 6
m_Component:
- component: {fileID: 4697876554718994}
- component: {fileID: 114893495464812296}
- component: {fileID: 114365820678688162}
- component: {fileID: 8633372399177808977}
m_Layer: 0

m_Father: {fileID: 4510310561805642}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: -6.2260003, y: 92.13901, z: -8.748}
--- !u!114 &114893495464812296
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1644875021134472}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: eecd6cb8bdc2e41d59a685729dc92753, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &114365820678688162
MonoBehaviour:
m_ObjectHideFlags: 0

- component: {fileID: 7584629329387862775}
- component: {fileID: 6451274724614238769}
- component: {fileID: 8974694563192370115}
- component: {fileID: 6599702836842835066}
- component: {fileID: 8474289352248162271}
m_Layer: 0
m_Name: Geo_Props_WindSurfer_LOD1

m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!114 &6599702836842835066
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 265483452859364355}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: eecd6cb8bdc2e41d59a685729dc92753, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &8474289352248162271
MonoBehaviour:
m_ObjectHideFlags: 0

- component: {fileID: 5729659731548558530}
- component: {fileID: 3695630706571852644}
- component: {fileID: 5752799900009478651}
- component: {fileID: 8675375912062046878}
- component: {fileID: 8408722718294511566}
m_Layer: 0
m_Name: Geo_Props_WindSurfer_LOD0

m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!114 &8675375912062046878
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8011136013803616369}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: eecd6cb8bdc2e41d59a685729dc92753, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &8408722718294511566
MonoBehaviour:
m_ObjectHideFlags: 0

14
Assets/Scripts/Boat/Engine.cs


using UnityEngine;
using System;
using UnityEngine;
using Unity.Collections;
using WaterSystem;
using Unity.Mathematics;

//engine stats
public float steeringTorque = 5f;
public float horsePower = 18f;
private float3[] point = new float3[1]; // engine submerged check
private NativeArray<float3> point; // engine submerged check
private float3[] heights = new float3[1]; // engine submerged check
private float3[] normals = new float3[1]; // engine submerged check
private int _guid;

waterSound.time = UnityEngine.Random.Range(0f, waterSound.clip.length); // randomly start the water sound
_guid = GetInstanceID(); // Get the engines GUID for the buoyancy system
point = new NativeArray<float3>(1, Allocator.Persistent);
}
void FixedUpdate()

// Get the water level from the engines position and store it
point[0] = transform.TransformPoint(enginePosition);
GerstnerWavesJobs.UpdateSamplePoints(point, _guid);
GerstnerWavesJobs.UpdateSamplePoints(ref point, _guid);
private void OnDisable()
{
point.Dispose();
}
/// <summary>
/// Controls the acceleration of the boat
/// </summary>

37
Assets/Scripts/Environment/BuoyManager.cs


using UnityEngine;
using Unity.Collections;
using UnityEngine;
public ParticleSystem particleSystem;
public ParticleSystem.ShapeModule particleShape;
private Mesh _mesh;
private Vector3[] verts;
private float3[] samplePoints; // sample points for height calc
private NativeArray<float3> samplePoints; // sample points for height calc
private float3[] heights; // water height array(only size of 1 when simple or non-physical)
private float3[] normals; // water normal array(only used when non-physical and size of 1 also when simple)

_guid = gameObject.GetInstanceID();
buoys = new Transform[transform.childCount];
samplePoints = new float3[buoys.Length];
_mesh = new Mesh();
int[] triangles = new int[buoys.Length * 3];
verts = new Vector3[buoys.Length];
samplePoints = new NativeArray<float3>(buoys.Length, Allocator.Persistent);
heights = new float3[buoys.Length];
normals = new float3[buoys.Length];

samplePoints[i] = buoys[i].position;
verts[i] = samplePoints[i];
triangles[3 * i] = i;
triangles[3 * i + 1] = (int)Mathf.Repeat(i + 1, buoys.Length);
triangles[3 * i + 2] = (int)Mathf.Repeat(i + 2, buoys.Length);
_mesh.vertices = verts;
_mesh.triangles = triangles;
if (particleSystem)
{
particleShape = particleSystem.shape;
particleShape.mesh = _mesh;
}
}
private void OnDisable()
{
samplePoints.Dispose();
GerstnerWavesJobs.UpdateSamplePoints(samplePoints, _guid);
GerstnerWavesJobs.UpdateSamplePoints(ref samplePoints, _guid);
GerstnerWavesJobs.GetData(_guid, ref heights, ref normals);
for (int i = 0; i < buoys.Length; i++)

buoys[i].position = vec;
verts[i] = vec;
_mesh.vertices = verts;
}
}

2
Assets/Scripts/Environment/WindsurferManager.cs.meta


fileFormatVersion: 2
guid: eecd6cb8bdc2e41d59a685729dc92753
guid: 23313225b48b84cc8ba0722dd9f5b25d
MonoImporter:
externalObjects: {}
serializedVersion: 2

992
Assets/scenes/Island.unity
文件差异内容过多而无法显示
查看文件

30
Packages/com.verasl.water-system/Scripts/BuoyantObject.cs


//
using System;
using System.Collections;
using Unity.Collections;
using UnityEngine;
using Unity.Mathematics;

[SerializeField]
private Vector3[] voxels; // voxel position
private float3[] samplePoints; // sample points for height calc
private NativeArray<float3> samplePoints; // sample points for height calc
private float3[] heights; // water height array(only size of 1 when simple or non-physical)
private float3[] normals; // water normal array(only used when non-physical and size of 1 also when simple)
private float3[] velocity; // voxel velocity for buoyancy

RB.centerOfMass = centerOfMass + voxelBounds.center;
baseDrag = RB.drag;
baseAngularDrag = RB.angularDrag;
velocity = new float3[voxels.Length];
float archimedesForceMagnitude = WATER_DENSITY * Mathf.Abs(Physics.gravity.y) * volume;
localArchimedesForce = new float3(0, archimedesForceMagnitude, 0) / voxels.Length;
}
if (_buoyancyType == BuoyancyType.NonPhysical || _buoyancyType == BuoyancyType.Physical)

}
velocity = new float3[voxels.Length];
samplePoints = new float3[voxels.Length];
float archimedesForceMagnitude = WATER_DENSITY * Mathf.Abs(Physics.gravity.y) * volume;
localArchimedesForce = new float3(0, archimedesForceMagnitude, 0) / samplePoints.Length;
}
private void Start()

debugInfo = new DebugDrawing[voxels.Length];
heights = new float3[voxels.Length];
normals = new float3[voxels.Length];
LocalToWorldConversion();
if (_buoyancyType == BuoyancyType.Physical || _buoyancyType == BuoyancyType.PhysicalVoxel)
{
LocalToWorldJob.SetupJob(_guid, voxels, ref samplePoints);
LocalToWorldConversion();
}
}
void SetupColliders()

void Update()
{
GerstnerWavesJobs.UpdateSamplePoints(samplePoints, _guid);
GerstnerWavesJobs.GetData(_guid, ref heights, ref normals);
if(_buoyancyType == BuoyancyType.NonPhysical || _buoyancyType == BuoyancyType.NonPhysicalVoxel) // if acurate the are more points so only heights are needed

}
else
{
LocalToWorldJob.CompleteJob(_guid);
GerstnerWavesJobs.UpdateSamplePoints(ref samplePoints, _guid);
for (int i = 0; i < voxels.Length; i++)
{
velocity[i] = RB.GetPointVelocity(samplePoints[i]);

if (_buoyancyType == BuoyancyType.Physical || _buoyancyType == BuoyancyType.PhysicalVoxel)
{
float submergedAmount = 0f;
samplePoints = LocalToWorldJob.CompleteJob(_guid);
LocalToWorldJob.CompleteJob(_guid);
if (_buoyancyType == BuoyancyType.PhysicalVoxel)
{

if (_buoyancyType == BuoyancyType.Physical || _buoyancyType == BuoyancyType.PhysicalVoxel)
{
Matrix4x4 transformMatrix = transform.localToWorldMatrix;
LocalToWorldJob.ScheduleJob(_guid, voxels, transformMatrix);
LocalToWorldJob.ScheduleJob(_guid, transformMatrix);
}
}

2
Packages/com.verasl.water-system/Scripts/GerstnerWavesJobs.cs


waveNormal.Dispose();
}
public static void UpdateSamplePoints(float3[] samplePoints, int guid)
public static void UpdateSamplePoints(ref NativeArray<float3> samplePoints, int guid)
{
CompleteJobs();
int2 offsets;

34
Packages/com.verasl.water-system/Scripts/LocalToWorldJob.cs


using Unity.Jobs;
using Unity.Burst;
using Unity.Mathematics;
using UnityEngine.Assertions;
public static class LocalToWorldJob
{

}
}
public static void ScheduleJob(int guid, Vector3[] positions, Matrix4x4 localToWorld)
public static void SetupJob(int guid, Vector3[] positions, ref NativeArray<float3> output)
if (!_data.ContainsKey(guid))
{
TransformLocalToWorld jobData = new TransformLocalToWorld();
jobData.positionsWorld = new NativeArray<float3>(positions.Length, Allocator.Persistent);
jobData.positionsLocal = new NativeArray<float3>(positions.Length, Allocator.Persistent);
for (var i = 0; i < positions.Length; i++)
jobData.positionsLocal[i] = positions[i];
_data.Add(guid, jobData);
}
TransformLocalToWorld jobData = new TransformLocalToWorld();
jobData.positionsWorld = new NativeArray<float3>(positions.Length, Allocator.Persistent);
jobData.positionsLocal = new NativeArray<float3>(positions.Length, Allocator.Persistent);
for (var i = 0; i < positions.Length; i++)
jobData.positionsLocal[i] = positions[i];
_data.Add(guid, jobData);
output = jobData.positionsWorld;
}
public static void ScheduleJob(int guid, Matrix4x4 localToWorld)
{
if (_data[guid].processing)
return;

JobHandle.ScheduleBatchedJobs();
}
public static float3[] CompleteJob(int guid)
public static void CompleteJob(int guid)
if (_data.ContainsKey(guid))
{
_data[guid].handle.Complete();
_data[guid].processing = false;
return _data[guid].job.positionsWorld.ToArray();
}
return null;
_data[guid].handle.Complete();
_data[guid].processing = false;
//return _data[guid].job.positionsWorld;
}
public static void Cleanup(int guid)

63
Assets/Scripts/Environment/WindsurferManager.cs


using System;
using UnityEngine;
using WaterSystem;
using Unity.Mathematics;
using System.Collections;
using System.Collections.Generic;
using Unity.Collections;
namespace BoatAttack
{
/// <summary>
/// This controls the logic for the wind surfer
/// </summary>
public class WindsurferManager : MonoBehaviour
{
public Transform[] surfers;
private NativeArray<float3> points; // point to sample wave height
private float3[] heights; // height sameple from water system
private float3[] normals; // height sameple from water system
private Vector3[] smoothPositions; // the smoothed position
private int _guid; // the objects GUID for wave height lookup
// Use this for initialization
void Start()
{
_guid = gameObject.GetInstanceID();
heights = new float3[surfers.Length];
normals = new float3[surfers.Length];
smoothPositions = new Vector3[surfers.Length];
for (int i = 0; i < surfers.Length; i++)
{
smoothPositions[i] = surfers[i].position;
}
points = new NativeArray<float3>(surfers.Length, Allocator.Persistent);
}
private void OnDisable()
{
points.Dispose();
}
// Update is called once per frame - TODO - need to validate logic here (not smooth at all in demo)
void Update()
{
GerstnerWavesJobs.UpdateSamplePoints(ref points, _guid);
GerstnerWavesJobs.GetData(_guid, ref heights, ref normals);
for (int i = 0; i < surfers.Length; i++)
{
smoothPositions[i] = surfers[i].position;
// Sample the water height at the current position
points[0] = smoothPositions[i];
if (heights[0].y > smoothPositions[i].y)
smoothPositions[i].y += Time.deltaTime;
else
smoothPositions[i].y -= Time.deltaTime * 0.25f;
surfers[i].position = smoothPositions[i];
}
}
}
}

42
Assets/Scripts/Environment/WindsurferLogic.cs


using UnityEngine;
using WaterSystem;
using Unity.Mathematics;
using System.Collections;
using System.Collections.Generic;
namespace BoatAttack
{
/// <summary>
/// This controls the logic for the wind surfer
/// </summary>
public class WindsurferLogic : MonoBehaviour
{
private float3[] point = new float3[1]; // point to sample wave height
private float3[] heights = new float3[1]; // height sameple from water system
private float3[] normals = new float3[1]; // height sameple from water system
private Vector3 smoothPosition; // the smoothed position
private int _guid; // the objects GUID for wave height lookup
// Use this for initialization
void Start()
{
_guid = gameObject.GetInstanceID();
smoothPosition = transform.position;
}
// Update is called once per frame - TODO - need to validate logic here (not smooth at all in demo)
void Update()
{
smoothPosition = transform.position;
// Sample the water height at the current position
point[0] = transform.position;
GerstnerWavesJobs.UpdateSamplePoints(point, _guid);
GerstnerWavesJobs.GetData(_guid, ref heights, ref normals);
if (heights[0].y > smoothPosition.y)
smoothPosition.y += Time.deltaTime;
else
smoothPosition.y -= Time.deltaTime * 0.25f;
transform.position = smoothPosition;
}
}
}

/Assets/Scripts/Environment/WindsurferLogic.cs.meta → /Assets/Scripts/Environment/WindsurferManager.cs.meta

正在加载...
取消
保存