Ejemplo n.º 1
0
    /// <summary>
    /// This create or destroy the create plane that the user can see where the new Way is gonna
    /// be created
    /// </summary>
    public void CreateOrKillCursor()
    {
        KillCursor();

        Control.BuildWayCursor = (BigBoxPrev)CreatePlane.CreatePlan(Root.bigBoxPrev, Root.matGreenSel2);
        Control.BuildWayCursor.transform.name = "Cursor for:" + Control.CurrentSpawnBuild.MyId;
    }
Ejemplo n.º 2
0
    /// <summary>
    /// Called from Update if createSoilNow = true
    /// Creates all the planes for the farm. Based on initial position and scale
    /// </summary>
    /// <param name="pos">The list of initial positions for each tile</param>
    /// <param name="containerP">The container will hold all tiles. Usually is this.transform</param>
    void CreatePlanesRoutine(List <Vector3> pos, Transform containerP)
    {
        if (loopCounter < pos.Count)
        {
            CreatePlane temp = null;

            if (HType == H.Road)
            {
                temp = CreatePlane.CreatePlanSmartTile(this, Root.createPlane, Root.RetMaterialRoot(MaterialKey),
                                                       pos[loopCounter], scale: Program.gameScene.ScaleSmallRoadUnitFarm, container: containerP);
            }
            else
            {
                temp = CreatePlane.CreatePlan(Root.createPlane, Root.RetMaterialRoot(MaterialKey),
                                              pos[loopCounter], scale: Program.gameScene.ScaleSmallRoadUnitFarm, container: containerP, hType: HType);
            }



            _planesSoil.Add(temp);
            loopCounter++;
        }
        else
        {
            createSoilNow = false;
            AfterLoopRoutine();
        }
    }
Ejemplo n.º 3
0
    //this cretes planes vertically and horizontally
    List <CreatePlane> CreatePlanesVertAndHor(RegFile regFile, H which, Transform containerP, Trail trail)
    {
        List <CreatePlane> res = new List <CreatePlane>();

        if (which == H.Vertic)
        {
            for (int i = 0; i < regFile.TilePosVert.Count; i++)
            {
                res.Add(CreatePlane.CreatePlan(Root.createPlane, Root.RetMaterialRoot(regFile.MaterialKey),
                                               regFile.TilePosVert[i], scale: regFile.TileScale, container: containerP));

                //to Refine
                //Trail.AddToCrystals(H.PlanesVertic, i, regFile.TilePosVert[i], regFile.TilePosVert.Count,
                //    regFile.TilePosHor.Count, trail);
            }
        }
        else if (which == H.Horiz)
        {
            for (int i = 0; i < regFile.TilePosHor.Count; i++)
            {
                res.Add(CreatePlane.CreatePlan(Root.createPlane, Root.RetMaterialRoot(regFile.MaterialKey),
                                               regFile.TilePosHor[i], scale: regFile.TileScale, container: containerP));

                //to Refine
                //Trail.AddToCrystals(H.PlanesHor, i, regFile.TilePosHor[i], regFile.TilePosVert.Count,
                //    regFile.TilePosHor.Count, trail);
            }
        }
        return(res);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Creates the planes of a bridge, The first and last one
    /// </summary>
    Trail CreateBridgePlanes(Trail current, RegFile regFile)
    {
        if (regFile.DominantSide == H.Vertic)
        {
            current.PlanesListVertic.Add(CreatePlane.CreatePlan(Root.createPlane,
                                                                Root.RetMaterialRoot(regFile.MaterialKey),
                                                                regFile.TilePosVert[0], scale: regFile.TileScale, container: current.transform));

            current.PlanesListVertic.Add(CreatePlane.CreatePlan(Root.createPlane,
                                                                Root.RetMaterialRoot(regFile.MaterialKey),
                                                                regFile.TilePosVert[regFile.TilePosVert.Count - 1], scale: regFile.TileScale,
                                                                container: current.transform));
        }
        else if (regFile.DominantSide == H.Horiz)
        {
            current.PlanesListHor.Add(CreatePlane.CreatePlan(Root.createPlane,
                                                             Root.RetMaterialRoot(regFile.MaterialKey),
                                                             regFile.TilePosHor[0], scale: regFile.TileScale, container: current.transform));

            current.PlanesListHor.Add(CreatePlane.CreatePlan(Root.createPlane,
                                                             Root.RetMaterialRoot(regFile.MaterialKey),
                                                             regFile.TilePosHor[regFile.TilePosHor.Count - 1], scale: regFile.TileScale,
                                                             container: current.transform));
        }
        return(current);
    }
Ejemplo n.º 5
0
    private void CreateBasePlane()
    {
        var dimen = _fieldFarm.SpaceBtwPlants - 0.5f;

        var locPoly   = UPoly.CreatePolyFromVector3(transform.position, dimen, dimen);
        var basePlane = CreatePlane.CreatePlan(Root.createPlane, Root.matFarmSoil, raiseFromFloor: 0.08f, container: transform);

        basePlane.UpdatePos(locPoly);
    }
Ejemplo n.º 6
0
    /// <summary>
    ///  Creates the trail.
    /// </summary>
    private void BuildWay(string rootPlane, bool makeWayInvisible = false)
    {
        Material baseMat = Resources.Load <Material>(Root.RetMaterialRoot(MaterialKey));

        if (CurrentLoop == H.PlanesVertic)
        {
            if (_counter < _planesDimVertic.Count && _prevWayVertic.Count > 0)
            {
                PlanesListVertic.Add(CreatePlane.CreatePlan(rootPlane, Root.matGravilla, m.HitMouseOnTerrain.point,
                                                            container: transform, mat: baseMat));

                //if is the last one or 1st I will show it even if is set to be not seen like I do in bridges
                if (_counter == _planesDimVertic.Count - 1 || _counter == 0)
                {
                    makeWayInvisible = false;
                }
                PlanesListVertic[_counter].UpdatePos(_planesDimVertic[_counter], makeThisInvisible: makeWayInvisible);

                //to Refine
                //AddToCrystals(CurrentLoop, _counter,
                //    PlanesListVertic[_counter].transform.position, _planesDimVertic.Count, _planesDimHor.Count, this);

                _counter++;
            }
            else
            {
                _counter     = 0;
                _currentLoop = H.PlanesHor;
            }
        }
        else if (CurrentLoop == H.PlanesHor)
        {
            if (_counter < _planesDimHor.Count && _prevWayHor.Count > 0)
            {
                PlanesListHor.Add((CreatePlane.CreatePlan(rootPlane, Root.matGravilla, m.HitMouseOnTerrain.point,
                                                          container: transform, mat: baseMat)));

                //if is the last one I will show it even if is set to be not seen like I do in bridges
                if (_counter == _planesDimHor.Count - 1 || _counter == 0)
                {
                    makeWayInvisible = false;
                }
                PlanesListHor[_counter].UpdatePos(_planesDimHor[_counter], makeThisInvisible: makeWayInvisible);

                //to Refine
                //AddToCrystals(CurrentLoop, _counter,
                //  PlanesListHor[_counter].transform.position, _planesDimVertic.Count, _planesDimHor.Count, this);

                _counter++;
            }
            else
            {
                DoneWithLoop();
            }
        }
    }
Ejemplo n.º 7
0
Archivo: Way.cs Proyecto: Cdrix/SM
 void InitializeBigBoxPrev()
 {
     if (verticBigBox == null || horizBigBox == null)
     {
         verticBigBox = (BigBoxPrev)CreatePlane.CreatePlan(Root.bigBoxPrev, Root.matGreenSel2);
         verticBigBox.transform.name = "verticBigBox:" + MyId;
         horizBigBox = (BigBoxPrev)CreatePlane.CreatePlan(Root.bigBoxPrev, Root.matGreenSel2);
         horizBigBox.transform.name = "horizBigBox:" + MyId;
     }
 }
Ejemplo n.º 8
0
    // Use this for initialization
    private void Start()
    {
        base.Start();

        //if is not position fixed alredy we create the preview
        //when is Position Fixed already here mean that was loaded from file
        if (!PositionFixed)
        {
            farmPrev = (BigBoxPrev)CreatePlane.CreatePlan(Root.bigBoxPrev, Root.matGreenSel2);
            farmPrev.transform.name = "Farm Preview: " + MyId;
        }

        if (HType == H.Road)
        {
            maxSizeOfFarm = 500;
        }
    }
Ejemplo n.º 9
0
    void Start()
    {
        _animator = gameObject.GetComponent <Animator>();
        _hover    = GetChildCalled("Hover");
        _hover.gameObject.SetActive(false);

        var poly = U2D.FromRectToPoly(Region);

        buildingPrev = (BigBoxPrev)CreatePlane.CreatePlan(Root.bigBoxPrev, Root.dashedLinedSquare, container: transform);
        buildingPrev.UpdatePos(poly, .25f);
        buildingPrev.transform.position = U2D.FromV2ToV3(Region.center);

        //MeshController.CrystalManager1.CrystalRegions[Index].StartWithAudioReport();
        Name  = "Buy region";
        HType = H.BuyRegion;

        transform.position += new Vector3(0, 10000, 0);
    }
Ejemplo n.º 10
0
    /// <summary>
    /// Creates the plane of pos lineanly
    /// </summary>
    List <CreatePlane> CreatePlanes(List <Vector3> pos, Transform containerP, Vector3 scaleP, string materialKey, Building spawner)
    {
        List <CreatePlane> res = new List <CreatePlane>();

        for (int i = 0; i < pos.Count; i++)
        {
            if (spawner.HType == H.Road)
            {
                res.Add(CreatePlane.CreatePlanSmartTile(spawner, Root.createPlane, Root.RetMaterialRoot(materialKey),
                                                        pos[i], scale: scaleP, container: containerP, isLoadingFromFile: true));
            }
            else
            {
                res.Add(CreatePlane.CreatePlan(Root.createPlane, Root.RetMaterialRoot(materialKey),
                                               pos[i], scale: scaleP, container: containerP));
            }
        }
        return(res);
    }
Ejemplo n.º 11
0
    /// <summary>
    /// Creates a Plane for the base of the Strcuture
    /// </summary>
    void CreateBasePlane()
    {
        var locPoly = UPoly.ScalePoly(Anchors, 0.04f);

        basePlane = CreatePlane.CreatePlan(Root.createPlane, ReturnMatBase(), raiseFromFloor: 0.08f, container: transform);
    }