예제 #1
0
        private void _loadDoor(Asset asset)
        {
            GameObject go = AssetPackUtilities.LoadAsset <GameObject>(_bundle, asset.Guid);

            if (go == null)
            {
                throw new Exception("Can't find Object:" + asset.Guid);
            }

            WallBuilder <Door> doorBuilder = Parkitility.CreateWall <Door>(go)
                                             .Id(asset.Guid)
                                             .BuildLayerMask(LayerMasks.TERRAIN)
                                             .Price(asset.Price, false)
                                             .DisplayName(asset.Name)
                                             .CustomColor(AssetPackUtilities.ConvertColors(asset.CustomColors, asset.ColorCount))
                                             .BlockRain(asset.BlocksRain)
                                             .HeightChangeDelta(asset.HeightDelta)
                                             .SnapGridToCenter(true)
                                             .OnGrid(true)
                                             .GridSubdivisions(1f)
                                             .Category(asset.Category, asset.SubCategory)
                                             .SeeThrough(asset.SeeThrough);

            if (asset.IsResizable)
            {
                doorBuilder.Resizable(asset.MinSize, asset.MaxSize);
            }

            doorBuilder.Build(_assetManagerLoader);
        }
예제 #2
0
        public static void Execute(Vegas vegas)
        {
            var configData = new WallBuilderConfiguration();

            if (!GetConfigurationFromUser(configData))
            {
                return;
            }

            var wallTracks = WallBuilder.BuildWall(vegas.Project.Video.Width, vegas.Project.Video.Height, configData);

            using (var undo = new UndoBlock("Insert Video Wall"))
            {
                var trackNumber = 0;

                var videoTracks = VegasHelper.GetTracks <VideoTrack>(vegas);

                foreach (var track in wallTracks)
                {
                    var videoTrack = SelectOrInsertVideoTrack(vegas, videoTracks, trackNumber);
                    trackNumber += 1;

                    SetTrackKeyFrames(videoTrack, track);
                }
            }
        }
예제 #3
0
 public static void reset()
 {
     for (int i = 0; i < objects.Count; i++)
     {
         if (objects[i].tag == "train")
         {
             TrackBuilder tb = objects[i].GetComponent <RollerCoaster>().tb; if (tb != null)
             {
                 tb.reset();
             }
         }
         else if (objects[i].tag == "wall")
         {
             WallBuilder wb = objects[i].GetComponent <Wall>().wb; if (wb != null)
             {
                 wb.reset();
             }
         }
         GameObject.Destroy(objects[i]);
     }
     objects.Clear();
     animals.Clear();
     rollerCoasters.Clear();
     walls.Clear();
     Data.activeObj          = 0;
     Data.startingPointIndex = -1;
     GameObject.Destroy(landscape);
 }
예제 #4
0
 public static WallBuilder getBuilder()
 {
     if (me == null)
     {
         me = FindObjectOfType <WallBuilder> ();
     }
     return(me);
 }
예제 #5
0
 private void Start()
 {
     jsonManager = GameObject.Find("JsonManager").GetComponent <JsonManager>();
     wallBuilder = GameObject.Find("WallBuilder").GetComponent <WallBuilder>();
     if (jsonManager == null || wallBuilder == null)
     {
         Debug.LogError("Component Miss!!! 12099ufs0");
     }
 }
예제 #6
0
 private void executeWall()
 {
     Debug.Log("line script:" + wallScript);
     if (wb != null)
     {
         wb.reset();
     }
     wb = new WallBuilder(obj);
     wb.setModel("fence");
     wb.generate(wallScript);
 }
예제 #7
0
    public void Click(object h)
    {
        RaycastHit hit           = (RaycastHit)h;
        GameObject hitGameObject = hit.collider.gameObject;

        Debug.Log("HIT ON '" + hitGameObject.name + "' RECEIVED IN '" + gameObject.name + "'");

        WallBuilder wb = Wall.GetComponent <WallBuilder>();

        wb.Build();
    }
예제 #8
0
    public WallGenerator(WallBuilder tmp_gt)
    {
        gt = tmp_gt;

        wall       = new GameObject();
        track_main = new GameObject("poles");
        railings   = new GameObject("planks");

        track_main.transform.parent = wall.transform;
        railings.transform.parent   = wall.transform;
    }
예제 #9
0
        private void TryReverse(ref Vertex v1, ref Vertex v2)
        {
            bool reverse = WallBuilder.NormalCloserToPoint(v1.Point, v2.Point, Camera.main.transform.position);

            if (reverse)
            {
                Vertex temp = v1;
                v1   = v2;
                v2   = temp;
                temp = null;
            }
        }
예제 #10
0
    void loadWall(int index)
    {
        GameObject  obj = Data.objects[index];
        WallBuilder wb;
        Wall        wall = obj.GetComponent <Wall>();
        MainObject  mo   = obj.GetComponent <MainObject>();

        if (wall.wb != null)
        {
            wall.wb.reset();
            wb = wall.wb;
        }
        wb = new WallBuilder(obj);
        wb.setModel(mo.model);
        wb.generate(mo.script);
        wall.wb = wb;
    }
예제 #11
0
    void OnEnableGUI()
    {
        // Get components.
        m_wallBuilder           = target as WallBuilder;
        m_wallBuilderProperties = m_wallBuilder.GetComponent <WallBuilderProperties>();

        // Instantiate preview models
        if (!IsPrefab())
        {
            var wallBuilder = (WallBuilder)target;

            m_previewWall        = InstantiatePreviewModel(wallBuilder.m_wall);
            m_previewWallHasDoor = InstantiatePreviewModel(wallBuilder.m_wallHasDoor);
            m_previewColumn      = InstantiatePreviewModel(wallBuilder.m_column);

            BuildWallSystem(true);
        }
    }
예제 #12
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        // Cast target as WallBuilder type.
        // so you can access all functions within
        // it.
        WallBuilder builder = (WallBuilder)target;

        if (GUILayout.Button("Build Wall"))
        {
            builder.buildTheWall();
        }

        if (GUILayout.Button("Destroy Wall"))
        {
            builder.destroyWall();
        }
    }
예제 #13
0
    private void drawLine(string[] func)
    {
        string script;
        float  angle  = float.Parse(func[4]) - 90;
        float  length = float.Parse(func[5]);

        setPosition(func);

        script  = "wall 1 left " + angle + " 0;";
        script += "wall " + length + " forward 0 0;";
        Debug.Log("line script:" + script);
        if (wb != null)
        {
            wb.reset();
        }
        wb = new WallBuilder(obj);
        wb.setModel("fence");
        wb.generate(script);
        //Object.Destroy(obj);
    }
예제 #14
0
        private void Awake()
        {
            BlockBuilder b     = new LooseBlock();
            var          block = b.Build(new Vector3(0.0f, 0.0f, 0.0f), 8, 0.5f);

            block.AddComponent <BlockCollision>();
            var r = block.AddComponent <Rigidbody>();

            r.useGravity = false;
            block.AddComponent <BlockRotation>();
            block.AddComponent <BlockMovement>();


            Camera.main.GetComponent <PanTarget>().Target = block.transform;

            var w    = new WallBuilder();
            var wall = w.Build(new Vector3(0.0f, 0.0f, 20.0f), new Dimensions(1, 21, 21), block, 0.5f);

            Helper.RandomlyOrientate(block);
        }
예제 #15
0
        public void CalculateWallProperties_Test()
        {
            WallBuilder wb = new WallBuilder();

            wb.SetUpWallBuilder(2);
            Assert.AreEqual(2, wb.AnzahlKloetze);
            Assert.AreEqual(3, wb.MauerBreite);
            Assert.AreEqual(2, wb.MaxMauerHoehe);
            Assert.AreEqual(2, wb.AnzahlFugenStellen);

            wb.SetUpWallBuilder(4);
            Assert.AreEqual(4, wb.AnzahlKloetze);
            Assert.AreEqual(10, wb.MauerBreite);
            Assert.AreEqual(3, wb.MaxMauerHoehe);
            Assert.AreEqual(9, wb.AnzahlFugenStellen);

            wb.SetUpWallBuilder(10);
            Assert.AreEqual(10, wb.AnzahlKloetze);
            Assert.AreEqual(55, wb.MauerBreite);
            Assert.AreEqual(6, wb.MaxMauerHoehe);
        }
예제 #16
0
        public void CalculateWallProperties_Test()
        {
            var wb = new WallBuilder();

            wb.BricksPerRow = 2;
            wb.CalculateWallProperties();
            Assert.AreEqual(2, wb.BricksPerRow);
            Assert.AreEqual(3, wb.WallLength);
            Assert.AreEqual(2, wb.WallHeight);
            Assert.AreEqual(2, wb.GapCount);
            Assert.AreEqual(2, wb.UsedGapCount);
            Assert.AreEqual(0, wb.FreeGaps);

            wb.BricksPerRow = 3;
            wb.CalculateWallProperties();
            Assert.AreEqual(3, wb.BricksPerRow);
            Assert.AreEqual(6, wb.WallLength);
            Assert.AreEqual(2, wb.WallHeight);
            Assert.AreEqual(5, wb.GapCount);
            Assert.AreEqual(4, wb.UsedGapCount);
            Assert.AreEqual(1, wb.FreeGaps);

            wb.BricksPerRow = 4;
            wb.CalculateWallProperties();
            Assert.AreEqual(4, wb.BricksPerRow);
            Assert.AreEqual(10, wb.WallLength);
            Assert.AreEqual(3, wb.WallHeight);
            Assert.AreEqual(9, wb.GapCount);
            Assert.AreEqual(9, wb.UsedGapCount);

            wb.BricksPerRow = 10;
            wb.CalculateWallProperties();
            Assert.AreEqual(10, wb.BricksPerRow);
            Assert.AreEqual(55, wb.WallLength);
            Assert.AreEqual(6, wb.WallHeight);
        }
예제 #17
0
 private void Start()
 {
     _wallSpawner = gameObject.GetComponent <WallBuilder>();
 }
예제 #18
0
 public void setGenerateWall(WallBuilder g)
 {
     gt = g;
 }
    void compile()
    {
        Compiler.setCode(currentCode);
        Data.output = "";
        if (Compiler.compile())
        {
            Debug.Log("compilation succesfull");
            GameObject obj = Data.objects[Data.activeObj];
            if (obj.tag == "animal")
            {
            }
            else if (obj.tag == "train")
            {
                TrackBuilder  tb;
                RollerCoaster rc = obj.GetComponent <RollerCoaster>();
                MainObject    mo = obj.GetComponent <MainObject>();
                if (rc.tb != null)
                {
                    rc.tb.reset();
                    //tb = rc.tb;
                }
                tb = new TrackBuilder(obj);;
                tb.setModel(mo.model);
                tb.setType(0);
                tb.generate(mo.script);
                rc.tb = tb;
            }
            else if (obj.tag == "wall")
            {
                WallBuilder wb;
                Wall        wall = obj.GetComponent <Wall>();
                MainObject  mo   = obj.GetComponent <MainObject>();
                if (wall.wb != null)
                {
                    wall.wb.reset();
                    //tb = rc.tb;
                }
                wb = new WallBuilder(obj);
                wb.setModel(mo.model);
                wb.generate(mo.script);
                wall.wb = wb;
            }
            else if (obj.tag == "graph")
            {
                GraphPlotter gp;

                Graph      graph = obj.GetComponent <Graph>();
                MainObject mo    = obj.GetComponent <MainObject>();
                if (graph.gp != null)
                {
                    graph.gp.reset();
                    //tb = rc.tb;
                }
                gp = new GraphPlotter(obj);
                gp.generate(mo.script);
                graph.gp = gp;
            }
        }
        else
        {
            Debug.Log("compilation error:" + Compiler.getError());
            Data.output += Compiler.getError() + "\n";
        }
    }