Ejemplo n.º 1
0
    void detector_Collided(Volume collisonObject, Voxel voxel, Vector3 worldPosition)
    {
        // If the bullet hits an invader and is owned by the player, explode and destroy the invader - and deactivate the bullet
        if (collisonObject.name == "Invader" && Owner is InvadersPlayerShip)
        {
            collisonObject.Destruct(3f, true);
            Destroy(collisonObject.gameObject);
            gameObject.SetActive(false);
        }

        // If we hit a shield, just explode and deactivate the bullet
        if (collisonObject.name == "Shield")
        {
            exploder.ExplosionRadius = 1f;
            exploder.Explode();
            gameObject.SetActive(false);
        }

        // If we hit the player ship
        if (collisonObject.name == "Player Ship")
        {
            collisonObject.Destruct(3f, true);
            collisonObject.GetComponent<InvadersPlayerShip>().Die();
            gameObject.SetActive(false);
        }
    }