Ejemplo n.º 1
0
        private void Update()
        {
            // we hit the mouse button
            if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
            {
                Ray mouseRay;
                mouseRay = UnityEngine.Camera.main.ScreenPointToRay(Input.mousePosition);

                RaycastHit hitInfo;

                // we hit the object
                if (Physics.Raycast(mouseRay, out hitInfo))
                {
                    var obj = hitInfo.collider.gameObject;

                    if (Input.GetMouseButtonDown(0))
                    {
                        Exploder.ExplodePartial(obj, mouseRay.direction, hitInfo.point, 1.0f, (ms, state) =>
                        {
                            if (state == ExploderObject.ExplosionState.ExplosionFinished)
                            {
                                Debug.Log("Explosion finished");
                            }
                        });
                    }
                }
            }
        }