Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BoomMaster
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanqing
BoomMaster
Commits
f31b2ece
Commit
f31b2ece
authored
Mar 09, 2021
by
wanqing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
65dcd7af
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
37 deletions
+37
-37
BombView.cs
BoomMaster/Assets/#A2_Scripts/Battle/View/BombView.cs
+37
-37
No files found.
BoomMaster/Assets/#A2_Scripts/Battle/View/BombView.cs
View file @
f31b2ece
...
...
@@ -2,7 +2,7 @@
using
System.Collections.Generic
;
using
UnityEngine
;
using
RayFire
;
using
EzySlice
;
//
using EzySlice;
public
class
BombView
:
MonoBehaviour
{
...
...
@@ -447,47 +447,47 @@ public class BombView : MonoBehaviour
m_lstDamage
.
Clear
();
m_lstDamage
=
null
;
}
void
Slice
()
{
Collider
[]
hits
=
Physics
.
OverlapBox
(
m_rayFireBlade
.
transform
.
position
,
new
Vector3
(
5
,
0.1f
,
5
),
m_rayFireBlade
.
transform
.
rotation
,
layerMask
);
Debug
.
LogError
(
hits
.
Length
);
if
(
hits
.
Length
<=
0
)
return
;
//
void Slice()
//
{
//
Collider[] hits = Physics.OverlapBox(m_rayFireBlade.transform.position, new Vector3(5, 0.1f, 5), m_rayFireBlade.transform.rotation, layerMask);
//
Debug.LogError(hits.Length);
//
if (hits.Length <= 0)
//
return;
for
(
int
i
=
0
;
i
<
hits
.
Length
;
i
++)
{
//SlicedHull hull = SliceObject(hits[i].gameObject, crossMaterial);
SlicedHull
hull
=
SliceObject
(
hits
[
i
].
gameObject
);
if
(
hull
!=
null
)
{
GameObject
bottom
=
hull
.
CreateLowerHull
(
hits
[
i
].
gameObject
,
crossMaterial
);
GameObject
top
=
hull
.
CreateUpperHull
(
hits
[
i
].
gameObject
,
crossMaterial
);
AddHullComponents
(
bottom
);
AddHullComponents
(
top
);
Destroy
(
hits
[
i
].
gameObject
);
}
}
}
//
for (int i = 0; i < hits.Length; i++)
//
{
//
//SlicedHull hull = SliceObject(hits[i].gameObject, crossMaterial);
//
SlicedHull hull = SliceObject(hits[i].gameObject);
//
if (hull != null)
//
{
//
GameObject bottom = hull.CreateLowerHull(hits[i].gameObject, crossMaterial);
//
GameObject top = hull.CreateUpperHull(hits[i].gameObject, crossMaterial);
//
AddHullComponents(bottom);
//
AddHullComponents(top);
//
Destroy(hits[i].gameObject);
//
}
//
}
//
}
void
AddHullComponents
(
GameObject
go
)
{
go
.
layer
=
9
;
Rigidbody
rb
=
go
.
AddComponent
<
Rigidbody
>();
rb
.
interpolation
=
RigidbodyInterpolation
.
Interpolate
;
MeshCollider
collider
=
go
.
AddComponent
<
MeshCollider
>();
collider
.
convex
=
true
;
//
void AddHullComponents(GameObject go)
//
{
//
go.layer = 9;
//
Rigidbody rb = go.AddComponent<Rigidbody>();
//
rb.interpolation = RigidbodyInterpolation.Interpolate;
//
MeshCollider collider = go.AddComponent<MeshCollider>();
//
collider.convex = true;
rb
.
AddExplosionForce
(
100
,
go
.
transform
.
position
,
20
);
}
//
rb.AddExplosionForce(100, go.transform.position, 20);
//
}
SlicedHull
SliceObject
(
GameObject
obj
,
Material
crossSectionMaterial
=
null
)
{
// slice the provided object using the transforms of this object
if
(
obj
.
GetComponent
<
MeshFilter
>()
==
null
)
return
null
;
//
SlicedHull SliceObject(GameObject obj, Material crossSectionMaterial = null)
//
{
//
// slice the provided object using the transforms of this object
//
if (obj.GetComponent<MeshFilter>() == null)
//
return null;
return
obj
.
Slice
(
m_rayFireBlade
.
transform
.
position
,
m_rayFireBlade
.
transform
.
up
,
crossSectionMaterial
);
}
//
return obj.Slice(m_rayFireBlade.transform.position, m_rayFireBlade.transform.up, crossSectionMaterial);
//
}
//刀处理
void
UpdateKniftHandle
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment