Commit f31b2ece authored by wanqing's avatar wanqing

修改代码

parent 65dcd7af
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using RayFire; using RayFire;
using EzySlice; //using EzySlice;
public class BombView : MonoBehaviour public class BombView : MonoBehaviour
{ {
...@@ -447,47 +447,47 @@ public class BombView : MonoBehaviour ...@@ -447,47 +447,47 @@ public class BombView : MonoBehaviour
m_lstDamage.Clear(); m_lstDamage.Clear();
m_lstDamage = null; m_lstDamage = null;
} }
void Slice() //void Slice()
{ //{
Collider[] hits = Physics.OverlapBox(m_rayFireBlade.transform.position, new Vector3(5, 0.1f, 5), m_rayFireBlade.transform.rotation, layerMask); // Collider[] hits = Physics.OverlapBox(m_rayFireBlade.transform.position, new Vector3(5, 0.1f, 5), m_rayFireBlade.transform.rotation, layerMask);
Debug.LogError(hits.Length); // Debug.LogError(hits.Length);
if (hits.Length <= 0) // if (hits.Length <= 0)
return; // return;
for (int i = 0; i < hits.Length; i++) // for (int i = 0; i < hits.Length; i++)
{ // {
//SlicedHull hull = SliceObject(hits[i].gameObject, crossMaterial); // //SlicedHull hull = SliceObject(hits[i].gameObject, crossMaterial);
SlicedHull hull = SliceObject(hits[i].gameObject); // SlicedHull hull = SliceObject(hits[i].gameObject);
if (hull != null) // if (hull != null)
{ // {
GameObject bottom = hull.CreateLowerHull(hits[i].gameObject, crossMaterial); // GameObject bottom = hull.CreateLowerHull(hits[i].gameObject, crossMaterial);
GameObject top = hull.CreateUpperHull(hits[i].gameObject, crossMaterial); // GameObject top = hull.CreateUpperHull(hits[i].gameObject, crossMaterial);
AddHullComponents(bottom); // AddHullComponents(bottom);
AddHullComponents(top); // AddHullComponents(top);
Destroy(hits[i].gameObject); // Destroy(hits[i].gameObject);
} // }
} // }
} //}
void AddHullComponents(GameObject go) //void AddHullComponents(GameObject go)
{ //{
go.layer = 9; // go.layer = 9;
Rigidbody rb = go.AddComponent<Rigidbody>(); // Rigidbody rb = go.AddComponent<Rigidbody>();
rb.interpolation = RigidbodyInterpolation.Interpolate; // rb.interpolation = RigidbodyInterpolation.Interpolate;
MeshCollider collider = go.AddComponent<MeshCollider>(); // MeshCollider collider = go.AddComponent<MeshCollider>();
collider.convex = true; // collider.convex = true;
rb.AddExplosionForce(100, go.transform.position, 20); // rb.AddExplosionForce(100, go.transform.position, 20);
} //}
SlicedHull SliceObject(GameObject obj, Material crossSectionMaterial = null) //SlicedHull SliceObject(GameObject obj, Material crossSectionMaterial = null)
{ //{
// slice the provided object using the transforms of this object // // slice the provided object using the transforms of this object
if (obj.GetComponent<MeshFilter>() == null) // if (obj.GetComponent<MeshFilter>() == null)
return 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() void UpdateKniftHandle()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment