Пример #1
0
    private static int CheckGrid(FarmGrid farmGrid, List <FarmGrid.Grid> fieldGrids, int checkGridX, int checkGridY, bool isIgnorePutedFlag)
    {
        int gridIndex = farmGrid.GetGridIndex(checkGridX, checkGridY);

        if (gridIndex != -1 && FarmUtility.IsPassableGrid(fieldGrids, gridIndex, isIgnorePutedFlag))
        {
            return(gridIndex);
        }
        return(-1);
    }
Пример #2
0
    private Vector3 GetExtendBuildPosition(FarmObjectSetting farmObjectSetting, FarmObject prevFarmObject)
    {
        FarmObjectSetting.ExtendBuildPositionSearchResult extendBuildPositionSearchResult = farmObjectSetting.SearchExtendBuildGrid(prevFarmObject);
        FarmGrid grid               = FarmRoot.Instance.Field.Grid;
        int      gridIndex          = grid.GetGridIndex(extendBuildPositionSearchResult.grid);
        Vector3  positionGridCenter = grid.GetPositionGridCenter(gridIndex, true);

        if (!extendBuildPositionSearchResult.isOutsideMap)
        {
            GUICameraControll component = FarmRoot.Instance.Camera.GetComponent <GUICameraControll>();
            if (null != component)
            {
                base.StartCoroutine(component.MoveCameraToLookAtPoint(positionGridCenter, 0f));
            }
        }
        return(positionGridCenter);
    }