Ejemplo n.º 1
0
    void Explode()
    {
        Destroy(gameObject);

        if (target != null)
        {
            player.RegisterDestroyed(target.DestroyCubes(strength));

            for (int i = 0; i < 4; i++)
            {
                RaycastHit hit;
                if (Physics.Raycast(checkRays[i], out hit, cubeSize))
                {
                    PlayerScript p;
                    CubeScript   c;
                    if ((p = hit.collider.GetComponent <PlayerScript>()) != null)
                    {
                        p.Kill();
                    }

                    if ((c = hit.collider.GetComponent <CubeScript>()) != null)
                    {
                        player.RegisterDestroyed(c.DestroyCube());
                    }
                }
            }
        }
    }