Exemplo n.º 1
0
        private void OnClickAddNode(Vector2 mousePosition, NodeType type)
        {
            switch (type)
            {
            case NodeType.Fractal:
                FractalNode fractal = FractalNode.CreateInstance <FractalNode>();
                fractal.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(fractal);
                Selection.activeObject = fractal;
                break;

            case NodeType.Cellular:
                CellularNode cellular = CellularNode.CreateInstance <CellularNode>();
                cellular.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(cellular);
                Selection.activeObject = cellular;
                break;

            case NodeType.Blend:
                BlendNode blend = BlendNode.CreateInstance <BlendNode>();
                blend.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(blend);
                Selection.activeObject = blend;
                break;

            case NodeType.Levels:
                LevelsNode levels = LevelsNode.CreateInstance <LevelsNode>();
                levels.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(levels);
                Selection.activeObject = levels;
                break;

            case NodeType.Normal:
                NormalNode normal = NormalNode.CreateInstance <NormalNode>();
                normal.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(normal);
                Selection.activeObject = normal;
                break;

            case NodeType.OneMinus:
                MinusOneNode n = MinusOneNode.CreateInstance <MinusOneNode>();
                n.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(n);
                Selection.activeObject = n;
                break;

            case NodeType.Color:
                FlatColor color = FlatColor.CreateInstance <FlatColor>();
                color.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(color);
                Selection.activeObject = color;
                break;

            case NodeType.Mix:
                MixNode mix = MixNode.CreateInstance <MixNode>();
                mix.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(mix);
                Selection.activeObject = mix;
                break;

            case NodeType.MaskMap:
                MakeMaskMap map = MakeMaskMap.CreateInstance <MakeMaskMap>();
                map.Init(mousePosition, currSize, currSize + currSize / 2, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(map);
                Selection.activeObject = map;
                break;

            case NodeType.Generator:
                TileGenerator generator = TileGenerator.CreateInstance <TileGenerator>();
                generator.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(generator);
                Selection.activeObject = generator;
                break;

            case NodeType.Warp:
                WarpNode warp = WarpNode.CreateInstance <WarpNode>();
                warp.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(warp);
                Selection.activeObject = warp;
                break;

            case NodeType.Blur:
                BlurNode blur = BlurNode.CreateInstance <BlurNode>();
                blur.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(blur);
                Selection.activeObject = blur;
                break;

            case NodeType.Occlusion:
                AmbientOcclusionNode occlusion = AmbientOcclusionNode.CreateInstance <AmbientOcclusionNode>();
                occlusion.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(occlusion);
                Selection.activeObject = occlusion;
                break;

            case NodeType.Tile:
                MakeItTile tile = MakeItTile.CreateInstance <MakeItTile>();
                tile.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(tile);
                Selection.activeObject = tile;
                break;

            case NodeType.Parabola:
                Parabola p = Parabola.CreateInstance <Parabola>();
                p.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(p);
                Selection.activeObject = p;
                break;

            case NodeType.Shape:
                Shape shape = Shape.CreateInstance <Shape>();
                shape.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(shape);
                Selection.activeObject = shape;
                break;

            case NodeType.Polygon:
                Polygon pol = Polygon.CreateInstance <Polygon>();
                pol.Init(mousePosition, currSize, currSize, inPointStyle, outPointStyle, OnClickInPoint, OnClickOutPoint, OnClickRemoveNode, this);
                nodes.Add(pol);
                Selection.activeObject = pol;
                break;
            }
        }