/// <summary>
    /// Extract the representation of <paramref name="shape"/> in the current Unity scene.
    /// </summary>
    /// <param name="shape">The reference shape.</param>
    /// <param name="handler">The handler which should contain the scene representation.</param>
    /// <returns></returns>
    Shape ExtractSceneRepresentation(Shape shape, MessageHandler handler)
    {
        Tes.Handlers.ShapeHandler shapeHandler = handler as Tes.Handlers.ShapeHandler;
        if (shapeHandler == null)
        {
            return(null);
        }

        // Extract a serialised version of the shape from the handler.
        return(shapeHandler.CreateSerialisationShapeFor(shape.ID));
    }
Exemplo n.º 2
0
    GameObject FindObjectFor(Shape shape, MessageHandler handler)
    {
        Tes.Handlers.ShapeHandler shapeHandler = handler as Tes.Handlers.ShapeHandler;
        if (shapeHandler == null)
        {
            return(null);
        }

        GameObject root = shapeHandler.Root;
        // Search for a child object with ShapeComponent.
        var shapeComponent = root.GetComponentInChildren <Tes.Handlers.ShapeComponent>();

        if (shapeComponent == null)
        {
            return(null);
        }

        return(shapeComponent.gameObject);
    }