public void Start()
        {
            var grid = new WorldGrid();

            GridUpdate.ResetGraph();

            Placer = new BuildingWorldPlacement(grid, m_PlaceableObjectChecker);

            World = this;
        }
        public void Start()
        {
            var position  = GetComponent <Transform>().position;
            var lowerLeft = position - (new Vector3(Width, Height, 0) / 2.0f);

            // move into the center of the square
            lowerLeft += new Vector3(0.5f, 0.5f);

            GridUpdate.MarkWalkable(GridCoordinate.FromVector3(lowerLeft), new Size(Width, Height), false);
        }
Esempio n. 3
0
        public ActionResult Edit(GridUpdate gridUpdate)
        {
            if (ModelState.IsValid)
            {
                _gridUpdateRepository.Update(gridUpdate);
                _unitOfWork.Commit();

                return(RedirectToAction("Index"));
            }

            return(View(gridUpdate));
        }
Esempio n. 4
0
        private void UpdateGrids(GridUpdate result)
        {
            var gridToUpdate = result.IsPlayerGrid
                ? dgPlayerShips
                : dgComputerShips;

            try
            {
                var cellToUpdate = gridToUpdate.Rows[result.RowIndexToUpdate].Cells[result.ColumnIndexToUpdate];
                cellToUpdate.Value = ConvertToDisplayValue(result.PanelType);
            }
            catch (Exception)
            {
                throw new ApplicationException
                          ("The game controller indicated that a certain grid space should be updated, "
                          + "but this space does not exist on the game board.");
            }
        }
Esempio n. 5
0
        /// <summary> Sets an area to have the cell values given by <paramref name="cellData"/>. </summary>
        /// <param name="bottomLeft"> The bottom left position of the area. </param>
        /// <param name="size"> The size of the area to set the value of. </param>
        /// <param name="cellData"> The value that the area should be set to. </param>
        public void Set(GridCoordinate bottomLeft, Size size, CellData cellData)
        {
            // TODO check for error conditions

            int width  = size.Width;
            int height = size.Height;
            int startX = bottomLeft.X;
            int startZ = bottomLeft.Z;

            for (int x = startX; x < startX + width; x++)
            {
                for (int z = startZ; z < startZ + height; z++)
                {
                    _gridChunk[new GridCoordinate(x, z)] = cellData;
                }
            }

            GridUpdate.MarkCost(bottomLeft, size, cellData.RawType * 10);
        }
Esempio n. 6
0
    void Start()
    {
        Instance = this;
        //Application.ExternalCall("MyFunction2", "Hello from Unity!");
        log = GameObject.Find("log").GetComponent <UILabel>();
        log.gameObject.SetActive(false);
        if (SystemInfo.supportedRenderTargetCount == 1)
        {
            OnIncompatible();
            //ShowLog( SystemInfo.supportedRenderTargetCount.ToString());
        }

        uiroot = GameObject.Find("UIRoot");
        tables = GameObject.Find("table1");
        gu1    = GameObject.Find("scroll_grid_1").GetComponent <GridUpdate>();
        gu2    = GameObject.Find("scroll_grid_2").GetComponent <GridUpdate>();
        gu3    = GameObject.Find("scroll_grid_3").GetComponent <GridUpdate>();
        gu4    = GameObject.Find("scroll_grid_4").GetComponent <GridUpdate>();
        //DrawOneAttackLonLat("{\"data\" : [1,1,20,20,40,40]}");
        //DrawAttackBatch("{\"list\":[{\"ID\":\"1\",\"eventtype\":\"蠕虫\",\"eventname\":\"事件名称\",\"srcip\":\"源ip\",\"dstip\":\"宿ip\",\"eventcount\":\"事件发生次数\",\"eventtime\":\"攻击时间\",\"eventlevel\":\"事件级别\",\"srcipposition\":\"源ip经纬度\",\"dstipposition\":\"宿ip经纬度\"},{\"ID\":\"1\",\"eventtype\":\"蠕虫\",\"eventname\":\"事件名称\",\"srcip\":\"源ip\",\"dstip\":\"宿ip\",\"eventcount\":\"事件发生次数\",\"eventtime\":\"攻击时间\",\"eventlevel\":\"事件级别\",\"srcipposition\":\"源ip经纬度\",\"dstipposition\":\"宿ip经纬度\"}]}");
    }