Example #1
0
 //判断是否要生成满墙
 private void JudgeIsNewFullWall()
 {
     if ((this.loopIndexNum >= 7 || this.loopIndexNum >= 14) && this.curHorizontalType == Global.WallHorizontalType.FRANCE)
     {
         if (this.loopIndexNum >= 7 && this.loopIndexNum < 14)
         {
             int randNum = Random.Range(1, 3);
             if (randNum == 1)
             {
                 this.curHorizontalType = Global.WallHorizontalType.SINGLE_WALL;
             }
             else
             {
                 this.curHorizontalType = Global.WallHorizontalType.FULL_WALL;
                 this.loopIndexNum      = 0;
             }
         }
         else
         {
             this.curHorizontalType = Global.WallHorizontalType.FULL_WALL;
             this.loopIndexNum      = 0;
         }
     }
     else
     {
         this.curHorizontalType = Global.WallHorizontalType.SINGLE_WALL;
     }
 }
Example #2
0
    //零散墙
    public void CreateSingleWall()
    {
        //1.确定生成的数目
        int num = this.GetRateNum(wallNum, wallNumRate);

        //2.确定位置
        if (num == 0)
        {
            GGDebug.Log("==================零散墙===================");
        }
        else if (num == 1)
        {
            int posIndex = Random.Range(1, 6);
            WallUnitController script = WallUnitController.Create();
            this.AddWallUnit(script.gameObject, this.GetWallPos(fWallPosX[posIndex - 1]));
            GGDebug.Log("==================零散墙===================");
        }
        else if (num == 2)
        {
            int posIndex1 = Random.Range(1, 6);
            int posIndex2 = this.GetDontSideNum(posIndex1);

            WallUnitController script = WallUnitController.Create();
            this.AddWallUnit(script.gameObject, this.GetWallPos(fWallPosX[posIndex1 - 1]));

            script = WallUnitController.Create();
            this.AddWallUnit(script.gameObject, this.GetWallPos(fWallPosX[posIndex2 - 1]));
            GGDebug.Log("==================零散墙===================");
        }

        this.curCreateWallIndex++;
        this.loopIndexNum++;
        this.curHorizontalType = Global.WallHorizontalType.FRANCE;
    }
Example #3
0
 //满墙
 public void CreateFullWall()
 {
     GGDebug.Log("==================满墙===================");
     for (int i = 0; i < fWallPosX.Length; i++)
     {
         WallUnitController script = WallUnitController.Create();
         this.AddWallUnit(script.gameObject, this.GetWallPos(fWallPosX[i]));
     }
     this.curCreateWallIndex++;
     this.curHorizontalType = Global.WallHorizontalType.FRANCE;
 }
    public static FranceUnitController Create(Global.WallHorizontalType franceType)
    {
        string prefabPath = PREFAB_PATH_1;

        if (franceType == Global.WallHorizontalType.FRANCE_1)
        {
            prefabPath = PREFAB_PATH_1;
        }
        else if (franceType == Global.WallHorizontalType.FRANCE_2)
        {
            prefabPath = PREFAB_PATH_2;
        }

        GameObject           go     = Instantiate(Resources.Load(prefabPath)) as GameObject;
        FranceUnitController script = go.GetComponent <FranceUnitController>();

        return(script);
    }
Example #5
0
 //转换当前行要创建的类型
 public void TransformHorizontalWallType(Global.WallHorizontalType type)
 {
     this.curHorizontalType = type;
 }