private void Awake() { detection = new DetectionSphere(Vector3.zero, 2f, SegmentVerticalType.Eight, SegmentCircleType.Eighteen); if (Instance == null) { Instance = this; } DontDestroyOnLoad(this); }
public void ExplodeAllImmediately() { if (swichOn) { foreach (var breakable in breakableObjDict.Values) { Vector3 crossPointLocal = breakable.transform.worldToLocalMatrix.MultiplyPoint(BrokenManager.Instance.crossPoint); Vector3 vec3 = breakable.transform.GetComponent <MeshFilter>().mesh.bounds.ClosestPoint(crossPointLocal); if (DetectionSphere.IsInSphere(vec3, crossPointLocal, BrokenManager.Instance.detectionRadius)) { breakable.BeforeExplode(); breakable.Explode(); breakable.AfterExplode(); AddToExpireList(breakable); } } RemoveExpiredMembers(); } }