public IHttpActionResult PutWoodType(int id, WoodType woodType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != woodType.Id)
            {
                return(BadRequest());
            }

            db.Entry(woodType).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!WoodTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemplo n.º 2
0
    public GameObject PopWood(WoodType type)
    {
        GameObject wood;
        int        typeNumber = (int)type;

        if (woodPool[typeNumber].Count > 1)
        {
            wood = woodPool[typeNumber].Pop();
            wood.SetActive(true);

            wood.transform.rotation = defaultRotation;
            Rigidbody rigidbody = wood.GetComponent <Rigidbody>();
            rigidbody.velocity        = Vector3.zero;
            rigidbody.angularVelocity = Vector3.zero;

            return(wood);
        }
        else
        {
            GameObject instanceWood = woodPool[typeNumber].Pop();
            wood = Instantiate(instanceWood);
            PushWood(instanceWood);

            wood.SetActive(true);
            return(wood);
        }
    }
Exemplo n.º 3
0
        public Sapling(WoodType woodType)
        {
            Transparent = true;
            Solid       = false;

            BlockMaterial = Material.Plants;
        }
Exemplo n.º 4
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("CutBorder"))
        {
            EventManager.OnCuttingStarted();
            GameObject[] logs       = new GameObject[2];
            Transform    oTransform = other.transform.parent;
            WoodType     woodType   = (WoodType)other.gameObject.layer - 8;

            logs[0] = objectPool.PopLog((WoodType)other.transform.parent.gameObject.layer - 8);
            logs[1] = objectPool.PopLog((WoodType)other.transform.parent.gameObject.layer - 8);

            float offset = transform.position.x - oTransform.position.x;

            logs[0].transform.localScale = new Vector3(oTransform.localScale.x, oTransform.localScale.y / 2 - Math.Abs(offset), oTransform.localScale.z);
            logs[1].transform.localScale = new Vector3(oTransform.localScale.x, oTransform.localScale.y / 2 - Math.Abs(offset), oTransform.localScale.z);

            if (offset < 0) // Bıçak merkezin solundaysa
            {
                logs[0].transform.position = new Vector3(transform.position.x - ((logs[0].transform.localScale.y) + transform.localScale.y * 2), oTransform.position.y, oTransform.position.z);
                logs[1].transform.position = new Vector3(transform.position.x + ((logs[1].transform.localScale.y) + transform.localScale.y * 2), oTransform.position.y, oTransform.position.z);
            }
            else // Bıçak merkezin sağındaysa
            {
                logs[0].transform.position = new Vector3(transform.position.x + ((logs[0].transform.localScale.y) + transform.localScale.y * 2), oTransform.position.y, oTransform.position.z);
                logs[1].transform.position = new Vector3(transform.position.x - ((logs[1].transform.localScale.y) + transform.localScale.y * 2), oTransform.position.y, oTransform.position.z);
            }



            objectPool.PushWood(other.transform.parent.gameObject);
        }
    }
        public ActionResult DeleteConfirmed(int id)
        {
            WoodType woodType = db.WoodTypes.Find(id);

            db.WoodTypes.Remove(woodType);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public WoodType Create(WoodType model)
        {
            _ctx.WoodTypes.Add(model);

            _ctx.SaveChanges();

            return(model);
        }
 public ActionResult Edit([Bind(Include = "Id,Name")] WoodType woodType)
 {
     if (ModelState.IsValid)
     {
         db.Entry(woodType).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(woodType));
 }
        public ActionResult Create([Bind(Include = "Id,Name")] WoodType woodType)
        {
            if (ModelState.IsValid)
            {
                db.WoodTypes.Add(woodType);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(woodType));
        }
        public IHttpActionResult GetWoodType(int id)
        {
            WoodType woodType = db.WoodTypes.Find(id);

            if (woodType == null)
            {
                return(NotFound());
            }

            return(Ok(woodType));
        }
Exemplo n.º 10
0
        private void SetJoists()
        {
            RecSection section = IfJoist.Setup.Get <RecSection>("RecSection");
            WoodType   WT      = IfJoist.Setup.Get <WoodType>("WoodType");
            WoodGrade  WG      = IfJoist.Setup.Get <WoodGrade>("WoodGrade");

            foreach (var reg in FloorPolygon.Regions)
            {
                double span  = reg.IfDimension.XDim.Inches;
                var    Cells = JoistTable.Cells.Where(e =>
                                                      e.WoodGrade == WG &&
                                                      e.WoodType == WT &&
                                                      e.SpanToInch >= span &&
                                                      e.DeadLoadPsF == 10 &&
                                                      e.Section == section)
                               .OrderBy(e =>
                                        e.SpanToInch).ToList();
                double S      = Cells[0].Spacing;
                var    spaces = Split.Equal(reg.IfDimension.YDim - section.Width, S);

                for (int i = 0; i < spaces.Count; i++)
                {
                    //var spacingVec = new Vector3D(spaces[i], spaces[i], spaces[i]);
                    var DircVec = new IfLocation(
                        FloorPolygon.IfFloor.ShortDirection.Y * spaces[i],
                        FloorPolygon.IfFloor.ShortDirection.X * spaces[i],
                        FloorPolygon.IfFloor.ShortDirection.Z * spaces[i]
                        );

                    var ifJoist = new IfJoist(FloorPolygon.IfFloor)
                    {
                        IfModel    = FloorPolygon.IfFloor.IfModel,
                        IfFloor    = FloorPolygon.IfFloor,
                        IfLocation = DircVec,

                        IfDimension = new IfDimension(
                            section.Width.Inches,
                            section.Depth.Inches,
                            reg.IfDimension.XDim.Inches),

                        IfMaterial = IfMaterial.Setup.Get <IfMaterial>("Joist")
                    };

                    ifJoist.New();
                    ifJoist.IfMaterial.AttatchTo(ifJoist);
                    //add to studs elments
                    Joists.Add(ifJoist);



                    //
                }
            }
        }
Exemplo n.º 11
0
 public List <TableCell> GetCells(WoodType WT, WoodGrade WG, double DeadLoadPsf, double SpanInInches, double SectionDepth)
 {
     return(Cells.Where(e =>
                        e.WoodGrade == WG &&
                        e.WoodType == WT &&
                        e.DeadLoadPsF >= DeadLoadPsf &&
                        e.SpanToInch > SpanInInches &&
                        e.Section.Depth.Inches >= SectionDepth)
            .OrderBy(e => e.Section.Depth)
            .OrderBy(e => e.SpanToInch)
            .ToList());
 }
Exemplo n.º 12
0
        public IHttpActionResult PostWoodType(WoodType woodType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.WoodTypes.Add(woodType);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = woodType.Id }, woodType));
        }
Exemplo n.º 13
0
        // GET: WoodTypes/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            WoodType woodType = db.WoodTypes.Find(id);

            if (woodType == null)
            {
                return(HttpNotFound());
            }
            return(View(woodType));
        }
Exemplo n.º 14
0
        public IHttpActionResult DeleteWoodType(int id)
        {
            WoodType woodType = db.WoodTypes.Find(id);

            if (woodType == null)
            {
                return(NotFound());
            }

            db.WoodTypes.Remove(woodType);
            db.SaveChanges();

            return(Ok(woodType));
        }
Exemplo n.º 15
0
        public WallSign(WoodType woodType = WoodType.Oak) : base()
        {
            WoodType = woodType;

            Solid        = false;
            Transparent  = true;
            IsReplacible = false;
            Renderable   = false;
            CanInteract  = true;

            HasHitbox = true;

            //RequiresUpdate = true;

            Hardness      = 1;
            BlockMaterial = Material.Wood;
        }
Exemplo n.º 16
0
    public GameObject PopLog(WoodType type)
    {
        GameObject log;
        int        typeNumber = (int)type;

        if (logPool[typeNumber].Count > 1)
        {
            log = logPool[typeNumber].Pop();
            log.SetActive(true);
            return(log);
        }
        else
        {
            GameObject instanceLog = logPool[typeNumber].Pop();
            log = Instantiate(instanceLog);
            PushLog(instanceLog);

            log.SetActive(true);
            return(log);
        }
    }
Exemplo n.º 17
0
        public static bool TryConvert(this CraftResource r, out WoodType t)
        {
            if (r == CraftResource.None)
            {
                t = WoodType.None;
                return(true);
            }

            if (r < CraftResource.RegularWood)
            {
                t = WoodType.None;
                return(false);
            }

            if (r > CraftResource.Frostwood)
            {
                t = WoodType.None;
                return(false);
            }

            t = (WoodType)r;
            return(true);
        }
Exemplo n.º 18
0
 private void GenerateTree(ChunkColumn chunk, int x, int treebase, int z, WoodType woodType)
 {
     new OakTree().Create(chunk, x, treebase, z);
 }
Exemplo n.º 19
0
        public static Table Load(string filePath)
        {
            //get the static filePath

            var table = new Table();

            string[] file = File.ReadAllLines(filePath).Where(e => e != ",,,,,,,,").ToArray();

            string[]   Keys  = file[0].Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
            string[][] cells = new string[file.Length - 1][];
            for (int i = 0; i < cells.Length; i++)
            {
                cells[i] = file[i + 1].Split(new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);
            }

            for (int i = 0; i < cells.Length; i++)
            {
                for (int j = 3; j < 7; j++)
                {
                    Double     space   = Double.Parse(cells[i][0]);
                    RecSection section = new RecSection(int.Parse(Keys[j].Split('*')[0]), int.Parse(Keys[j].Split('*')[1]));
                    Length     L       = Length.FromFeetAndInches(int.Parse(cells[i][j].Split('-')[0]), int.Parse(cells[i][j].Split('-')[1]));
                    //Domain.Ifc.IfDimension Dim = new Domain.Ifc.IfDimension(int.Parse(Keys[j].Split('*')[0]),
                    //    int.Parse(Keys[j].Split('*')[1]),
                    //    int.Parse(cells[i][j].Split('-')[0]) * 12 + int.Parse(cells[i][j].Split('-')[1]));
                    WoodType  WT    = WoodType.Douglas_fir_larch;
                    WoodGrade WG    = new WoodGrade();
                    int       DLPsf = int.Parse(cells[i][7]);
                    switch (cells[i][1])
                    {
                    case "Douglas fir-larch":
                        WT = WoodType.Douglas_fir_larch;
                        break;

                    case "Hem-fir":
                        WT = WoodType.Hem_fir;
                        break;

                    case "Southern pine":
                        WT = WoodType.Southern_pine;
                        break;

                    case "Spruce-pine-fir":
                        WT = WoodType.Spruce_pine_fir;
                        break;

                    default:
                        break;
                    }
                    switch (cells[i][2])
                    {
                    case "SS":
                        WG = WoodGrade.SS;
                        break;

                    case "#1":
                        WG = WoodGrade._1;
                        break;

                    case "#2":
                        WG = WoodGrade._2;
                        break;

                    case "#3":
                        WG = WoodGrade._3;
                        break;

                    default:
                        break;
                    }
                    table.Cells.Add(new TableCell()
                    {
                        Spacing     = space,
                        Section     = section,
                        Span        = L,
                        WoodType    = WT,
                        WoodGrade   = WG,
                        DeadLoadPsF = DLPsf
                    });
                }
            }
            return(table);
        }
Exemplo n.º 20
0
 private void GenerateTree(ChunkColumn chunk, int x, int treebase, int z, WoodType woodType)
 {
     new OakTree().Create(chunk, x, treebase, z);
 }
Exemplo n.º 21
0
		public static bool TryConvert(this CraftResource r, out WoodType t)
		{
			if (r == CraftResource.None)
			{
				t = WoodType.None;
				return true;
			}

			if (r < CraftResource.RegularWood)
			{
				t = WoodType.None;
				return false;
			}

			if (r > CraftResource.Frostwood)
			{
				t = WoodType.None;
				return false;
			}

			t = (WoodType)r;
			return true;
		}