Ejemplo n.º 1
0
        public static void UpdatePlayer(
            AsyncRPGDataContext db_context,
            Player player)
        {
            var dbCharacter =
                (from p in db_context.Characters
                 where p.CharacterID == player.ID
                 select p).Single();

            dbCharacter.CharacterID = player.ID;
            dbCharacter.Name = player.Name;
            dbCharacter.Archetype = (int)player.Archetype;
            dbCharacter.Gender = (player.Gender == GameConstants.eGender.Male);
            dbCharacter.PictureID = player.PictureID;
            dbCharacter.PowerLevel = player.PowerLevel;
            dbCharacter.Energy = player.Energy;
            //TODO: dbCharacter.Health = this.Health;
            dbCharacter.GameID = player.RoomKey.game_id;
            dbCharacter.RoomX = player.RoomKey.x;
            dbCharacter.RoomY = player.RoomKey.y;
            dbCharacter.RoomZ = player.RoomKey.z;
            dbCharacter.X = player.Position.x;
            dbCharacter.Y = player.Position.y;
            dbCharacter.Z = player.Position.z;
            dbCharacter.Angle = player.Angle;

            db_context.SubmitChanges();
        }
Ejemplo n.º 2
0
        public static Player CreatePlayer(CharacterState characterState)
        {
            Player player = new Player();

            player.m_character_id = characterState.character_id;
            player.m_character_name = characterState.character_name;
            player.m_archetype = (GameConstants.eArchetype)characterState.archetype;
            player.m_gender = (GameConstants.eGender)characterState.gender;
            player.m_picture_id = characterState.picture_id;
            player.m_power_level = characterState.power_level;
            player.m_energy = characterState.energy;
            player.m_health = 0; //TODO: characterState.health;
            player.m_room_key =
                new RoomKey(
                    characterState.game_id,
                    characterState.room_x,
                    characterState.room_y,
                    characterState.room_z);
            player.m_position = new Point3d((float)characterState.x, (float)characterState.y, (float)characterState.z);
            player.m_angle = (float)characterState.angle;

            return player;
        }
Ejemplo n.º 3
0
        public static Player CreatePlayer(Characters dbCharacter)
        {
            Player player = new Player();

            player.m_character_id = dbCharacter.CharacterID;
            player.m_character_name = dbCharacter.Name;
            player.m_archetype = (GameConstants.eArchetype)dbCharacter.Archetype;
            player.m_gender = dbCharacter.Gender ? GameConstants.eGender.Male : GameConstants.eGender.Female;
            player.m_picture_id = dbCharacter.PictureID;
            player.m_power_level = dbCharacter.PowerLevel;
            player.m_energy = dbCharacter.Energy;
            player.m_health = 0; //TODO: characterState.health;
            player.m_room_key =
                new RoomKey(
                    dbCharacter.GameID,
                    dbCharacter.RoomX,
                    dbCharacter.RoomY,
                    dbCharacter.RoomZ);
            player.m_position = new Point3d(dbCharacter.X, dbCharacter.Y, dbCharacter.Z);
            player.m_angle = (float)dbCharacter.Angle;

            return player;
        }
Ejemplo n.º 4
0
 public void AddPlayer(Player player)
 {
     m_players.Add(player.ID, player);
 }