Exemple #1
0
    public void PlayerChangedRoom(string playerName, string newRoomPosition)
    {
        if (RoomsChecker.roomsDictionary.ContainsKey(
                RoomsChecker.RoomPositionFromText(newRoomPosition)
                ))
        {
            if (playerInstanceManager.playerInstancesOnScene.ContainsKey(playerName))
            {
                PlayerInstance otherPlayer = playerInstanceManager.playerInstancesOnScene[playerName];

                //Se borra al jugador de la habitación, revisando que nosotros no estuvieramos ahi
                otherPlayer.currentRoom.PlayerLeftRoom(
                    playerInstanceManager.playerInstancesOnScene[playerName], controller);

                //Se cambia la habitación actual del jugador
                otherPlayer.currentRoom =
                    RoomsChecker.RoomObjectFromVector(
                        RoomsChecker.RoomPositionFromText(newRoomPosition)
                        );

                //Se agrega al jugador a la nueva habitación
                otherPlayer.currentRoom.PlayerEnteredRoom(
                    playerInstanceManager.playerInstancesOnScene[playerName],
                    controller
                    );
            }
        }
    }
Exemple #2
0
    public void UpdatePlayerInstancesStats(PlayerInstance newPlayer, string[] playerData)
    {
        newPlayer.playerName = playerData[0];
        Int32.TryParse(playerData[1], out newPlayer.playerUserID);

        newPlayer.playerGender = playerData[2];
        Int32.TryParse(playerData[3], out newPlayer.playerLevel);

        newPlayer.playerJob   = StringsIntoObjectsInator.Instance.JobFromString(playerData[4]);
        newPlayer.playerRace  = StringsIntoObjectsInator.Instance.RaceFromString(playerData[5]);
        newPlayer.playerState = StringsIntoObjectsInator.Instance.StateFromString(playerData[6]);

        float.TryParse(playerData[7], out newPlayer.strength);
        float.TryParse(playerData[8], out newPlayer.intelligence);
        float.TryParse(playerData[9], out newPlayer.resistance);
        float.TryParse(playerData[10], out newPlayer.dexterity);

        float.TryParse(playerData[11], out newPlayer.currentHealth);

        Int32.TryParse(playerData[12], out newPlayer.currentVisibility);

        newPlayer.currentRoom = RoomsChecker.RoomObjectFromVector(
            RoomsChecker.RoomPositionFromText(playerData[13])
            );
    }