示例#1
0
    /// <summary>
    /// Intenta moverse en la dirección dada. Si esta dirección no pertenece a una salida, no se mueve.
    /// </summary>
    /// <param name="directionNoun"></param>
    public void AttemptToChangeRooms(DirectionKeyword directionNoun)
    {
        if (converter == null)
        {
            converter = KeywordToStringConverter.Instance;
        }

        if (exitDictionary.ContainsKey(directionNoun))
        {
            foreach (Exit e in currentRoom.exits)
            {
                if (e.myKeyword == directionNoun && !e.isAble)
                {
                    controller.LogStringWithReturn("No puedes ir en esa dirección.");
                    return;
                }
            }

            Exit exitToGo = exitDictionary[directionNoun];

            if (exitToGo.exitActionDescription == "")
            {
                controller.LogStringWithReturn("Te diriges hacia el " + converter.ConvertFromKeyword(directionNoun) + ".");
            }
            else
            {
                controller.LogStringWithReturn(exitToGo.exitActionDescription);
            }

            HideEnemies();

            currentRoom     = exitDictionary[directionNoun].conectedRoom;
            currentPosition = currentRoom.roomPosition;

            miniMapper.MovePlayerInMap(currentPosition);
            equipManager.updateText();
            inventoryManager.DisplayInventory();

            if (GlobalVariables.ContainsVariable("diario"))
            {
                if (GlobalVariables.GetValueOf("diario") == 1)
                {
                    controller.questManager.updateQuests();
                }
            }

            PlayerChangedRooms();             //Añadido para network

            controller.DisplayRoomText();
        }
        else if (directionNoun != DirectionKeyword.unrecognized)
        {
            controller.LogStringWithReturn("No hay caminos hacia el " + converter.ConvertFromKeyword(directionNoun) + ".");
        }
        else
        {
            controller.LogStringWithReturn("Eso sería bastante difícil.");
        }
    }
示例#2
0
    /// <summary>
    /// Salva todos los datos que se puedan cambiar de una habitación.
    /// </summary>
    /// <param name="roomToSave"></param>
    public static void SaveData(RoomObject roomToSave)
    {
        if (converter == null)
        {
            converter = KeywordToStringConverter.Instance;
        }


        Room_Data roomData = new Room_Data();

        roomData.roomPositionData    = roomToSave.roomPosition;
        roomData.roomDescriptionData = roomToSave.roomDescription;
        roomData.roomNameData        = roomToSave.roomName;
        roomData.exitsData           = new Exit_Data[roomToSave.exits.Count];
        if (roomToSave.exits.Count > 0)
        {
            for (int i = 0; i < roomData.exitsData.Length; i++)
            {
                roomData.exitsData[i] = new Exit_Data();
                roomData.exitsData[i].myKeywordData             = converter.ConvertFromKeyword(roomToSave.exits[i].myKeyword);
                roomData.exitsData[i].connectedRoomPosition     = roomToSave.exits[i].conectedRoom.roomPosition;
                roomData.exitsData[i].exitDescriptionData       = roomToSave.exits[i].exitDescription;
                roomData.exitsData[i].exitActionDescriptionData = roomToSave.exits[i].exitActionDescription;
                roomData.exitsData[i].isExplicit          = roomToSave.exits[i].isExplicit;
                roomData.exitsData[i].disabledDescription = roomToSave.exits[i].disabledDescription;

                roomData.exitsData[i].isAble = roomToSave.exits[i].isAble;
            }
        }
        SaveGame.Save <Room_Data>(roomToSave.name, roomData, SaveGamePath.RoomDataPath);
    }