Пример #1
0
def identicalMapMove(characterId, nowMap, nowMapSceneId, targetMapSceneId):
    movePath = MapHandle.getPathfinding(nowMap, nowMapSceneId,
                                        targetMapSceneId)
    if movePath != 'End' and movePath != 'Null':
        nowTargetSceneId = movePath['Path'][1]
        nowNeedTime = movePath['Time'][1]
        nowCharacterPosition = MapHandle.getScenePathForMapSceneId(
            nowMap, nowMapSceneId)
        nowTargetPosition = MapHandle.getScenePathForMapSceneId(
            nowMap, nowTargetSceneId)
        MapHandle.characterMoveScene(nowCharacterPosition, nowTargetPosition,
                                     characterId)
        GameTime.subTimeNow(nowNeedTime)
    return movePath
Пример #2
0
def identicalMapMove(characterId:str,nowMap:list,nowMapSceneId:str,targetMapSceneId:str) -> 'MoveEnd:str_Null,str_End,list':
    '''
    角色在相同地图层级内移动
    Keyword arguments:
    characterId -- 角色id
    nowMap -- 当前地图路径
    nowMapSceneId -- 当前角色所在场景(当前地图层级下的相对坐标)
    targetMapSceneId -- 寻路目标场景(当前地图层级下的相对坐标)
    '''
    nowMapStr = MapHandle.getMapSystemPathStrForList(nowMap)
    movePath = MapHandle.getPathfinding(nowMapStr,nowMapSceneId,targetMapSceneId)
    if movePath != 'End' and movePath != 'Null':
        nowTargetSceneId = movePath['Path'][0]
        nowNeedTime = movePath['Time'][0]
        nowCharacterPosition = MapHandle.getScenePathForMapSceneId(nowMap,nowMapSceneId)
        nowTargetPosition = MapHandle.getScenePathForMapSceneId(nowMap,nowTargetSceneId)
        MapHandle.characterMoveScene(nowCharacterPosition,nowTargetPosition,characterId)
        GameTime.subTimeNow(nowNeedTime)
    return movePath