コード例 #1
0
 private void SetMilitaryCampOriginData(MilitaryCampVO militaryCampVO)
 {
     militaryCampVO.rect = new RectInt(GlobalSetting.BUILDING_MILITARYCAMP_OFFSET[0],
                                       GlobalSetting.BUILDING_MILITARYCAMP_OFFSET[1],
                                       GlobalSetting.BUILDING_MILITARYCAMP_AREA[0],
                                       GlobalSetting.BUILDING_MILITARYCAMP_AREA[1]);
     militaryCampVO.soldierNumLimit = GlobalSetting.BUILDING_MILITARYCAMP_SOLDIER_LIMIT;
     militaryCampVO.trainNum        = GlobalSetting.BUILDING_MILITARYCAMP_OUTPUT;
 }
コード例 #2
0
    public void Build(PlayerVO ower, E_Building buildingType, MainBaseVO mainBaseVO)
    {
        IBuildingVO buildingVO = null;
        Vector3Int  center     = default;
        int         radius     = 0;
        int         count      = 0;

        if (mainBaseVO != null)
        {
            center = mainBaseVO.tilePositon;
            radius = mainBaseVO.radius;
        }
        switch (buildingType)
        {
        case E_Building.None:
            break;

        case E_Building.MainBase:
            buildingVO = new MainBaseVO();
            count      = GetBuildMainbasePositionClose(_ConstructionInfos, ower);
            break;

        case E_Building.FarmLand:
            buildingVO = new FarmLandVO();
            count      = GetBuildPosition(_ConstructionInfos, center, radius, buildingVO.rect);
            break;

        case E_Building.GoldMine:
            buildingVO = new GoldMineVO();
            count      = GetBuildPosition(_ConstructionInfos, center, radius, buildingVO.rect);
            break;

        case E_Building.MilitaryCamp:
            buildingVO = new MilitaryCampVO();
            count      = GetBuildPosition(_ConstructionInfos, center, radius, buildingVO.rect);
            break;

        default:
            break;
        }
        ConstructionInfo constructionInfo = _SelectConstructionHandler(_ConstructionInfos, count, 0);

        if (constructionInfo.isRotation)
        {
            buildingVO.Rotate();
        }
        buildingVO.tilePositon = constructionInfo.position;
        var msgParam = TwoMsgParamsPool <PlayerVO, IBuildingVO> .Instance.Pop();

        msgParam.InitParams(ower, buildingVO);
        sender.Invoke(GlobalSetting.Cmd_ConfirmConstruction, msgParam);
    }