示例#1
0
    /// <summary>
    /// 创建楼梯
    /// </summary>
    /// <param name="Core"></param>
    public static void CreateStair(CanvasCore Core)
    {
        ShipPlan P = ShipPlanDC.GetCurShipPlan();

        if (P == null)
        {
            return;
        }
        if (Core.m_type != ShipBuildType.BuildRoom && Core.IsDeckRoom)
        {
            return;
        }
        //只有房间变化楼梯才重新创建
        List <Int2> points = RoomMap.GetStairCreatePoint();

        if (points.Count > 0)
        {
            foreach (var grid in points)
            {
                ShipPutInfo Info = new ShipPutInfo();
                Info.id            = ShipPutInfo.GetNewShipPutId();
                Info.objid         = 1201;
                Info.type          = 3;
                Info.cxMapGrid     = grid.Unit;
                Info.cyMapGrid     = grid.Layer;
                Info.shipput_data0 = 0;
                Info.shipput_data1 = 0;
                P.AddShipBuildInfo(Info, ShipBuildType.BuildStair);
                BuildInfo stair = buildingM.GetStartBuildInfo(1201);
                ///// 临时修改,楼梯位置不正确的问题
                //stair.m_type = 1201;
                stair.m_cx           = grid.Unit;
                stair.m_cy           = grid.Layer;
                stair.m_ShipPutdata0 = 0;
                stair.m_ShipPutdata1 = 0;
                ///end
                if (stair != null)
                {
                    BattleEnvironmentM.LoadShipPutStairBuild(Info.id, Info.objid, stair);
                }
            }
        }
        RoomMap.RemoveExcessStair();
    }