Ejemplo n.º 1
0
    public void initialize(CanvasConfig config, CanvasCameraConfig canvasCameraConfig, Texture2D texture = null)
    {
        canvasBuffer   = new CanvasBuffer(config.canvasSize, config.bufferSize);
        this.config    = config;
        canvasCamera   = new CanvasCamera(canvasCameraConfig, config.canvasSize, gameObject);
        backLayer      = new CanvasLayer(config.canvasSize, 100, config.layersShader, canvasCamera);
        frontLayer     = new CanvasLayer(config.canvasSize, 20, config.layersShader, canvasCamera);
        radialLayer    = new CanvasRadialLayer(config.canvasSize, 25, config.radialFillShader, config.radialFillTexture, canvasCamera);
        canvasCollider = CanvasCollider.createCanvasCollider(config.canvasSize, 10, gameObject, canvasCamera);

        setNewPicture(texture);
        initialized = true;

        handleInnerEvents();
    }
Ejemplo n.º 2
0
    public static CanvasCollider createCanvasCollider(IntVector2 canvasSize, float zPosition, GameObject parent, CanvasCamera camera)
    {
        Mesh       mesh = MeshUtil.createPlaneMesh(canvasSize);
        GameObject go   = new GameObject("canvas collider");

        go.transform.parent        = parent.transform;
        go.transform.position      = new Vector3(0, 0, zPosition);
        go.transform.localRotation = Quaternion.identity;
        go.transform.localScale    = Vector3.one;
        MeshCollider mc = go.AddComponent <MeshCollider>();

        mc.sharedMesh = mesh;
        CanvasCollider ccc = go.AddComponent <CanvasCollider>();

        ccc.canvasCamera = camera;
        return(ccc);
    }
Ejemplo n.º 3
0
    public void initialize(CanvasConfig config, CanvasCameraConfig canvasCameraConfig, Texture2D texture=null)
    {
        canvasBuffer = new CanvasBuffer(config.canvasSize, config.bufferSize);
        this.config = config;
        canvasCamera = new CanvasCamera(canvasCameraConfig, config.canvasSize, gameObject);
        backLayer = new CanvasLayer(config.canvasSize, 100, config.layersShader, canvasCamera);
        frontLayer = new CanvasLayer(config.canvasSize, 20, config.layersShader, canvasCamera);
        radialLayer = new CanvasRadialLayer(config.canvasSize, 25, config.radialFillShader, config.radialFillTexture, canvasCamera);
        canvasCollider = CanvasCollider.createCanvasCollider (config.canvasSize, 10, gameObject, canvasCamera);

        setNewPicture(texture);
        initialized = true;

        handleInnerEvents();
    }