예제 #1
0
    //设置楼梯的参数
    public stairWay(GameObject pWallObj, isRoomFunc pCallBack,
                    GameObject pUpHill, GameObject pDownHill,
                    Vector3Int pPrev, Vector3Int pCurrent,
                    Vector3Int pPlaceStairs1, Vector3Int pPlaceStairs2, Vector3Int pPlaceStairs3, Vector3Int pPlaceStairs4,
                    int pNameIndex, GameObject pParentObj)
    {
        initData(pWallObj, pCallBack,
                 pUpHill, pDownHill,
                 pPrev, pCurrent,
                 pPlaceStairs1, pPlaceStairs2, pPlaceStairs3, pPlaceStairs4,
                 pNameIndex, pParentObj);

        /*
         * wallPrefab = pWallObj;
         * isRoomByPos = pCallBack;
         *
         *
         * upHillPrefab = pUpHill;
         * downHillPrefab = pDownHill;
         * prev = pPrev;
         * current = pCurrent;
         *
         * PlaceStairs1 = pPlaceStairs1;
         * PlaceStairs4 = pPlaceStairs4;
         * parentObj = pParentObj;
         *
         * //上坡1和4色块, 空中为3色块,无需处理的实心为2色块
         * //下坡1和4色块,空中为2色块,无需处理的实心为3色块
         * if (prev.y < current.y) //上坡
         * {
         *  isUpHill = true;
         * // PlaceStairsAir = pPlaceStairs3;
         * }
         * else if(prev.y > current.y) //下坡
         * {
         *  isUpHill = false;
         * //  PlaceStairsAir = pPlaceStairs2;
         * }
         * else
         * {
         *  Debug.LogError("stairWay error y is same");
         * }
         *
         * nameIndex = pNameIndex;
         */
    }
예제 #2
0
    //private Vector3Int PlaceStairsAir; //空中的格子


    /*
     * public stairWay(Vector3Int location, Vector3Int size, GameObject pPlaneObj, GameObject pWallObj, Material pMaterial, Grid3D<placeWall> pGrid) : base(location, size, pPlaneObj, pWallObj, pMaterial, pGrid)
     * {
     *
     * }
     */

    public void initData(GameObject pWallObj, isRoomFunc pCallBack,
                         GameObject pUpHill, GameObject pDownHill,
                         Vector3Int pPrev, Vector3Int pCurrent,
                         Vector3Int pPlaceStairs1, Vector3Int pPlaceStairs2, Vector3Int pPlaceStairs3, Vector3Int pPlaceStairs4,
                         int pNameIndex, GameObject pParentObj)
    {
        wallPrefab  = pWallObj;
        isRoomByPos = pCallBack;


        upHillPrefab   = pUpHill;
        downHillPrefab = pDownHill;
        prev           = pPrev;
        current        = pCurrent;

        PlaceStairs1 = pPlaceStairs1;
        PlaceStairs4 = pPlaceStairs4;
        parentObj    = pParentObj;

        //上坡1和4色块, 空中为3色块,无需处理的实心为2色块
        //下坡1和4色块,空中为2色块,无需处理的实心为3色块
        if (prev.y < current.y) //上坡
        {
            isUpHill = true;
            // PlaceStairsAir = pPlaceStairs3;
        }
        else if (prev.y > current.y) //下坡
        {
            isUpHill = false;
            //  PlaceStairsAir = pPlaceStairs2;
        }
        else
        {
            Debug.LogError("stairWay error y is same");
        }

        nameIndex = pNameIndex;
    }