コード例 #1
0
ファイル: GetInfo.cs プロジェクト: Asaxi/muqiangshibie
        public static string AddBuildingWall(string jsons)//添加立面信息
        {
            BuildingWall data   = JsonConvert.DeserializeObject <BuildingWall>(jsons);
            string       result = HTTPService.AddBuildingWall(data);

            return(result);
        }
コード例 #2
0
ファイル: WallBuilder.cs プロジェクト: Axuim/Tower-Defense
    void Awake()
    {
        _buildingWall = GameObject.Instantiate <BuildingWall>(_buildingWallPrefab);
        _buildingWall.transform.parent = this.transform;
        _buildingWall.gameObject.SetActive(false);

        GameStateManager.GameStateChanged += this.GameStateChangedHandler;
    }
コード例 #3
0
ファイル: WallBuilder.cs プロジェクト: Axuim/Tower-Defense
    void Awake()
    {
        _buildingWall = GameObject.Instantiate<BuildingWall>(_buildingWallPrefab);
        _buildingWall.transform.parent = this.transform;
        _buildingWall.gameObject.SetActive(false);

        GameStateManager.GameStateChanged += this.GameStateChangedHandler;
    }
コード例 #4
0
        //创建立面
        public static string AddBuildingWall(BuildingWall data)
        {
            //Buildingwallresult result = new Buildingwallresult();
            string js       = JsonConvert.SerializeObject(data);
            string Response = Sender.Post("http://dev.strosoft.com:6090/BSS/api/Service?service_name=AddBuildingWall&data=" + js, "");

            //result = JsonConvert.DeserializeObject<Buildingwallresult>(response);
            //Console.WriteLine(result.data);
            return(Response);
        }
コード例 #5
0
    /// <summary>
    /// Generates the basic walls, floor, and entrance for any building.
    /// Picks the exact position of entrance, and returns it
    /// </summary>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <param name="buildingObjects">Building objects to be filled with walls</param>
    /// <param name="buildTiles"></param>
    /// <param name="entranceID"></param>
    /// <param name="style"></param>
    /// <returns></returns>
    public static Vec2i GenerateWallsFloorAndEntrance(int width, int height, WorldObjectData[,] buildingObjects,
                                                      Tile[,] buildTiles, int entranceID, BuildingStyle style, int entraceDis = -1, WorldObjectData wallType = null, Tile tileType = null)
    {
        int entWidth = 2;

        if (entraceDis == -1)
        {
            if (entranceID == NORTH_ENTRANCE || entranceID == SOUTH_ENTRANCE)
            {
                entraceDis = MiscMaths.RandomRange(1, width - 1);
            }
            else
            {
                entraceDis = MiscMaths.RandomRange(1, height - 1);
            }
        }

        //Decide the position of the entrance
        Vec2i entrance = null;

        if (entranceID == NORTH_ENTRANCE)
        {
            entrance = new Vec2i(entraceDis, height - 1);
        }
        else if (entranceID == SOUTH_ENTRANCE)
        {
            entrance = new Vec2i(entraceDis, 0);
        }
        else if (entranceID == EAST_ENTRANCE)
        {
            entrance = new Vec2i(width - 1, entraceDis);
        }
        else if (entranceID == WEST_ENTRANCE)
        {
            entrance = new Vec2i(0, entraceDis);
        }


        //Assign correct wall type if none given
        if (wallType == null)
        {
            switch (style)
            {
            case BuildingStyle.stone:
                wallType = new BrickWall(new Vec2i(0, 0));
                break;

            case BuildingStyle.wood:
                //TODO - Add
                wallType = new BrickWall(new Vec2i(0, 0));
                break;
            }
        }//Asign correct tile type if none given
        if (tileType == null)
        {
            switch (style)
            {
            case BuildingStyle.stone:
                tileType = Tile.STONE_FLOOR;
                break;

            case BuildingStyle.wood:
                tileType = Tile.WOOD_FLOOR;
                break;
            }
        }
        //Iterate all points
        for (int x = 0; x < width; x++)
        {
            for (int z = 0; z < height; z++)
            {
                //Asign tile
                buildTiles[x, z] = tileType;
                if (x == 0 || x == width - 1 || z == 0 || z == height - 1)
                {
                    //Asign wall if no entrance
                    if (!(entrance.x == x & entrance.z == z))
                    {
                        if (x == 3)
                        {
                            buildingObjects[x, z] = new BuildingWall(new Vec2i(0, 0), "brick", 5,
                                                                     new GlassWindow(new Vec2i(0, 0), new Vec2i(0, 1)), 2);
                        }
                        else
                        {
                            buildingObjects[x, z] = new BuildingWall(new Vec2i(0, -1), "brick", 5);
                        }
                    }
                }
            }
        }
        //(buildingObjects[0, 0] as BuildingWall).AddRoof(new Roof(new Vec2i(0, 0), new Vec2i(width, height)));

        return(entrance);
    }