// Update is called once per frame public void SetObjectDestroyed(GameObject collider, float xPos, float yPos) { //print("123"); var destructible = collider.GetComponent <Destroyable>(); if (destructible != null) { positionX = xPos; positionY = yPos; destructible.OnEndSplit.AddListener(OnEndSplit); DestroyableQuadFracturer.Fracture(destructible, 10, 0.5f); destructible.OnEndSplit.RemoveListener(OnEndSplit); //TODO: Explosion } }
public void SetObjectDestroyed(float damage, float xPosition) { print("damaged"); // Register split event destroyable.OnEndSplit.AddListener(OnEndSplit); // Split via fracture DestroyableQuadFracturer.Fracture(destroyable, fractureCount, 0.5f); //D2dQuadFracturer.Fracture(destroyable, FractureCount, 0.5f); // Unregister split event destroyable.OnEndSplit.RemoveListener(OnEndSplit); // Spawn explosion prefab? var worldRotation = Quaternion.Euler(0.0f, 0.0f, Random.Range(0.0f, 360.0f)); //GameObject.Instantiate(explosionPrefabObject, new Vector2(xPosition, this.gameObject.transform.position.y), worldRotation); }