Example #1
0
 /// <summary>
 /// 指定の建物が指定の数できたら鉄工所を指定の数になるまで建設します。
 /// </summary>
 /// <param name="count">建設する最大数</param>
 /// <param name="required">必要な建物</param>
 /// <param name="requiredCount">必要な建物の数</param>
 public BuildBlackSmith(short count, building required, short requiredCount)
     : base(building.blacksmith, count)
 {
     Facts.Add(
         new building_type_count_total(required, relop.ge, requiredCount)
         );
 }
Example #2
0
        // Puni model detaljima o zgradi koja se nalazi u gradu sa cityID, u redu row i koloni column

        public void fillBuildingsDetailsModel(int cityID, int row, int column, RS2Entities entities)
        {
            try
            {
                var result = (from BUILDING in entities.buildings
                              join CITY_BUILDINGS in entities.city_buildings on BUILDING.id equals CITY_BUILDINGS.building_id
                              where (CITY_BUILDINGS.city_id == cityID &&
                                     CITY_BUILDINGS.building_positionX == row &&
                                     CITY_BUILDINGS.building_positionY == column)
                              select new
                {
                    resultBuilding = BUILDING,
                    resultCityBuildings = CITY_BUILDINGS
                }
                              ).First();

                BuildingModel      = result.resultBuilding;
                CityBuildingsModel = result.resultCityBuildings;
            }
            catch
            {
                this.BuildingModel      = null;
                this.CityBuildingsModel = null;
            }
        }
Example #3
0
    public void buildStartBase()      // creates start place
    {
        putGround(mapProgressPosition, mapNum);
        drawSecondaryVisualEffects(mapProgressPosition, mapNum);
        drawThirdVisualEffects(mapProgressPosition, mapNum);
        putFances(mapProgressPosition, mapNum);

        Vector2 mapCorner = mapProgressPosition + new Vector2(-(mapSize.x - 1) / 2, (mapSize.y - 1) / 2) * step;

        g = new grid [(int)mapSize.y, (int)mapSize.x];

        for (int i = 0; i < mapSize.y; i++)
        {
            for (int c = 0; c < mapSize.x; c++)
            {
                g [i, c] = new grid(mapCorner + new Vector2(c, -i) * step, false);
            }
        }

        bool putBuilding = steps % environments [mapNum].buildingDensity == 0 ? true : false;

        putRoad(new Vector2(0, 0));
        putRoad(new Vector2(lineHeight, 0));

        building b = environments [mapNum].getBuilding();

        for (int i = 0; i < mapSize.y; i++)
        {
            GameObject newFance = Instantiate(b.side, g[i, 0].position - Vector2.right * step / 2 - new Vector2(10, 0), Quaternion.Euler(0, 0, randomSight())) as GameObject;
            newFance.GetComponent <barrierBehaviour>().health = Mathf.Infinity;
        }

        makeStep();
        drawMap();
    }
Example #4
0
    void build(Vector2 mapCorner, int num)
    {
        building b = environments [num].getBuilding();          // chooses random building

        for (int i = 1; i < lineHeight; i++)
        {
            for (int c = 1; c < mapSize.x - 1; c++)
            {
                bool putFloor = Random.Range(-1, 2) >= 0 ? true:false;
                //	if (putFloor)
                Instantiate(b.floor, g[(int)mapCorner.x + i, (int)mapCorner.y + c].position, Quaternion.identity);
                bool putBarrier = Random.Range(0, 10) >= 7 ? true:false;
                if (putBarrier)
                {
                    map.Add(Instantiate(getBarrier(), g[(int)mapCorner.x + i, (int)mapCorner.y + c].position, Quaternion.identity) as GameObject);
                }
            }
        }

        for (int c = 1; c < mapSize.x - 1; c++)         // builds fances
        {
            map.Add(Instantiate(b.top, g[(int)mapCorner.x + 1, (int)mapCorner.y + c].position + new Vector2(0, step), Quaternion.identity) as GameObject);
            map.Add(Instantiate(b.down, g[(int)mapCorner.x + (int)lineHeight - 1, (int)mapCorner.y + c].position, Quaternion.identity) as GameObject);
        }
    }
Example #5
0
        protected override void Insert(DataGridViewRow row)
        {
            try
            {
                using (var ctx = new OutpostDataContext())
                {
                    string new_building_name = ((string)row.Cells[MyHelper.strBuildingName].Value).RmvExtrSpaces();
                    var    new_outpost_id    = row.Cells[MyHelper.strOutpostId].Value;

                    if (ctx.buildings.AsEnumerable().FirstOrDefault(b => b.building_name.ToLower() == new_building_name.ToLower()) != null)
                    {
                        string eo = $"Здание {new_building_name} уже существует!";
                        MessageBox.Show(eo);
                        row.ErrorText = MyHelper.strBadRow + " " + eo;
                        return;
                    }

                    var new_building = new building();
                    new_building.building_name = new_building_name;
                    new_building.outpost_id    = (int?)new_outpost_id;

                    ctx.buildings.Add(new_building);
                    ctx.SaveChanges();

                    row.Cells[MyHelper.strSource].Value     = new_building;
                    row.Cells[MyHelper.strBuildingId].Value = new_building.building_id;
                    _buildingsDataTableHandler.Add(new_building.building_id, new_building.building_name);
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
        public ActionResult DeleteConfirmed(string id)
        {
            building building = db.buildings.Find(id);

            db.buildings.Remove(building);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "code,name,park")] building building)
 {
     if (ModelState.IsValid)
     {
         db.Entry(building).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(building));
 }
Example #8
0
    void Awake()
    {
        trackedObj          = GetComponentInParent <SteamVR_TrackedObject>();
        myLaser             = GetComponentInParent <SteamVR_LaserPointer>();
        myLaser.PointerIn  -= HandlePointerIn;
        myLaser.PointerIn  += HandlePointerIn;
        myLaser.PointerOut -= HandlePointerOut;
        myLaser.PointerOut += HandlePointerOut;

        myBuilding = null;
    }
        public ActionResult Create([Bind(Include = "code,name,park")] building building)
        {
            if (ModelState.IsValid)
            {
                db.buildings.Add(building);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(building));
        }
Example #10
0
 void                                            Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         Vector2 camPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         if (camPos.y < _mapLimits[0].position.y && camPos.y > _mapLimits[1].position.y && camPos.x <_mapLimits[2].position.x && camPos.x> _mapLimits[3].position.x)
         {
             RaycastHit2D hit = Physics2D.Raycast(camPos, Vector2.zero);
             if (hit && hit.collider)
             {
                 if (hit.collider.CompareTag("playerUnit") && !_footmanSelection.Contains(hit.collider.gameObject.GetComponent <footman> ()))
                 {
                     _ClearSelection <building> (_buildingSelection);
                     footman ftm = hit.collider.GetComponent <footman> ();
                     if (!Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift))
                     {
                         _ClearSelection <footman> (_footmanSelection);
                     }
                     ftm._selectedDisplay(true);
                     _footmanSelection.Add(ftm);
                 }
                 else if (hit.collider.CompareTag("building") && !_buildingSelection.Contains(hit.collider.gameObject.GetComponent <building> ()))
                 {
                     _ClearSelection <footman> (_footmanSelection);
                     building bldg = hit.collider.GetComponent <building> ();
                     if (!Input.GetKey(KeyCode.LeftShift) && !Input.GetKey(KeyCode.RightShift))
                     {
                         _ClearSelection <building> (_buildingSelection);
                     }
                     bldg._selectedDisplay(true);
                     _buildingSelection.Add(bldg);
                 }
                 //else if (CompareTag("orc")...)
                 //else if ("obstacle"...)
             }
             else
             {
                 foreach (footman ftm in _footmanSelection)
                 {
                     ftm.IsWalking          = true;
                     ftm.FootmanOrientation = _setUnitOrientation(camPos, ftm.transform.position);
                     ftm.TargetPos          = camPos;               //movePos
                     ftm._setCurrentAnimation();
                 }
             }
         }
     }
     else if (Input.GetMouseButtonDown(1))
     {
         _ClearSelection <footman> (_footmanSelection);
         _ClearSelection <building> (_buildingSelection);
     }
 }
    private const float maximumDelay = 15f; // Maximaler Dauer der extrapolation der Position eines Markers

    // Start is called before the first frame update
    void Start()
    {
        // starten des Vuforia Tracking Moduls
        trackerDevice = TrackerManager.Instance.InitTracker <PositionalDeviceTracker>();

        // Referenzbildung der Marker
        savedBuildings = FindObjectOfType <building>();
        targets        = savedBuildings.GetAllTargets();

        // 3D-Modelle deaktieren
        building.gameObject.SetActive(false);
    }
        // GET: buildings/Delete/5
        public ActionResult Delete(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            building building = db.buildings.Find(id);

            if (building == null)
            {
                return(HttpNotFound());
            }
            return(View(building));
        }
Example #13
0
    public bool addBuilding(int recivedMaterial, int recivedMineral, int recivedFood, int material, int mineral, int food, Building buildingType, int position, int[] workers)
    {
        building temp = new building(recivedMaterial, recivedMineral, recivedFood, material, mineral, food, buildingType, position, workers);

        for (int i = 0; i < buildings.Length; i++)
        {
            if (buildings[i].isNull())
            {
                buildings[i] = temp;
                return(true);
            }
        }
        return(false);
    }
Example #14
0
        public IActionResult sudBuildCon([FromBody] building obj)
        {
            //
            //***** Try Block
            try
            {
                //****** Declaration
                int           rowAffected = 0;
                string        sqlResponse = "";
                IActionResult response    = Unauthorized();

                using (IDbConnection con = new SqlConnection(db.dbCon))
                {
                    if (con.State == ConnectionState.Closed)
                    {
                        con.Open();
                    }

                    DynamicParameters parameters = new DynamicParameters();

                    parameters.Add("@BuildingShortName", obj.buildingShortName);
                    parameters.Add("@BuildingDescription", obj.buildingDescription);
                    parameters.Add("@BuildingAddress", obj.buildingAddress);
                    parameters.Add("@SubLocID", obj.subLocID);
                    parameters.Add("@projectId", obj.projectID);
                    parameters.Add("@PackageName", obj.packageName);
                    parameters.Add("@BuildingID", obj.buildingId);
                    parameters.Add("@Userid", obj.userID);
                    parameters.Add("@SpType", obj.spType);
                    parameters.Add("@ResponseMessage", dbType: DbType.String, direction: ParameterDirection.Output, size: 5215585);

                    rowAffected = con.Execute("dbo.Sp_Buildings", parameters, commandType: CommandType.StoredProcedure);
                    sqlResponse = parameters.Get <string>("@ResponseMessage");
                }

                response = Ok(new { msg = sqlResponse });

                return(response);
            }
            //***** Exception Block
            catch (Exception ex)
            {
                return(Ok(new { msg = ex.Message }));
            }
        }
Example #15
0
    void putFances(Vector2 origin, int num)              // puts fances so player can't go off playable map
    {
        building   b = environments [num].getBuilding(); // gets random building type
        GameObject wall;                                 // stores wall of this building type

        for (int i = 0; i < mapSize.x; i++)              // puts horizontal walls
        {
            wall = b.down;
            Vector2    pos      = origin + new Vector2((-(mapSize.x - 1) / 2) + i, (mapSize.y - 1) / 2) * step + new Vector2(0, step);
            GameObject newFance = Instantiate(wall, pos, Quaternion.identity) as GameObject;
            newFance.GetComponent <barrierBehaviour> ().health = Mathf.Infinity;
            map.Add(newFance);

            for (int u = 0; u < 7; u++)
            {
                map.Add(Instantiate(b.floor, pos + new Vector2(0, step * u), Quaternion.identity) as GameObject);
                map.Add(Instantiate(b.floor, pos - new Vector2(0, mapSize.y + u) * step, Quaternion.identity) as GameObject);
            }

            wall     = b.top;
            pos      = origin + new Vector2((-(mapSize.x - 1) / 2) + i, -(mapSize.y - 1) / 2) * step;
            newFance = Instantiate(wall, pos, Quaternion.identity) as GameObject;
            newFance.GetComponent <barrierBehaviour> ().health = Mathf.Infinity;
            map.Add(newFance);
        }

        for (int u = 0; u < 7; u++)          // puts vertical walls
        {
            Vector2 pos = origin + new Vector2((-(mapSize.x - 1) / 2), (mapSize.y - 1) / 2) * step + new Vector2(0, step);
            Instantiate(b.side, pos + new Vector2(-step / 2 + 10, step * u), Quaternion.Euler(0, 180, 0));

            pos = origin + new Vector2((-(mapSize.x - 1) / 2), -(mapSize.y - 1) / 2) * step - new Vector2(0, step);
            Instantiate(b.side, pos + new Vector2(-step / 2 + 10, -step * u), Quaternion.Euler(0, 180, 0));

            pos = origin + new Vector2(((mapSize.x - 1) / 2), (mapSize.y - 1) / 2) * step + new Vector2(0, step);
            Instantiate(b.side, pos + new Vector2(step / 2 - 10, step * u), Quaternion.Euler(0, 180, 0));

            pos = origin + new Vector2(((mapSize.x - 1) / 2), -(mapSize.y - 1) / 2) * step - new Vector2(0, step);
            Instantiate(b.side, pos + new Vector2(step / 2 - 10, -step * u), Quaternion.Euler(0, 180, 0));
        }
    }
Example #16
0
        public JsonResult AutoComplete(string searchTerm)
        {
            try
            {
                Buildings buildings    = new Buildings();
                var       buildingName = (from Buildings in buildings.GetBuildings()
                                          where Buildings.Name.StartsWith(searchTerm)
                                          select new
                {
                    label = Buildings.Name,
                    val = Buildings.id
                }).ToList();

                if (buildingName.Count > 0)
                {
                    return(Json(buildingName, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    building buildingterm = new building();
                    buildingterm.Name             = searchTerm;
                    buildingterm.managementid     = 3;
                    buildingterm.address          = "address";
                    buildingterm.ownershiptype    = "Post war";
                    buildingterm.unitaccess       = "unitaccess";
                    buildingterm.buildingfeatures = "features";
                    buildingterm.phonenumber      = "1231231234";
                    buildings.AddBuilding(buildingterm);
                    return(null);
                }
            }
            catch (Exception ex)
            {
                //handling exception
                throw ex;
            }
        }
Example #17
0
    public override void OnInspectorGUI()
    {
        building b_var = target as building;

        b_var.myType = (B_Type)EditorGUILayout.EnumPopup(b_var.myType);
    }
Example #18
0
 public void Planing(GameObject z, building b)
 {
     colz = z.GetComponentsInChildren <MeshRenderer>();
     bref = b;
 }
 public void SetBuilding(building b, Vector2 c)
 {
     //Debug.Log(c + " set");
     building = b;
     coords   = c;
 }
Example #20
0
 private void HandlePointerIn(object sender, PointerEventArgs e)
 {
     //Debug.Log("Point in event");
     myBuilding = e.target.GetComponent <building>();
 }
Example #21
0
 private void HandlePointerOut(object sender, PointerEventArgs e)
 {
     //Debug.Log("Point out event");
     myBuilding = null;
 }