Ejemplo n.º 1
0
        public CharacterData(DbCharactersData dbData)
        {
            _dbData = dbData ?? throw new Exception("DB data of new character cannot be NULL!");
            GameWorldData gameWorldData = GameWorldData.GetLastInstance();

            this.StartingLoc    = new Point3 <double>(Convert.ToDouble(_dbData.LocalPosX), Convert.ToDouble(_dbData.LocalPosY), Convert.ToDouble(_dbData.LocalPosZ));
            this.DestinationLoc = this.StartingLoc;
            this.CurrentLoc     = this.StartingLoc;
            this.Angle          = Convert.ToDouble(_dbData.LocalAngle);

            DateTime tNow = DateTime.Now;

            this.MovingStartTime = tNow;
            this.MovingEndTime   = tNow;

            this.AccId           = _dbData.AccId;
            this.CharId          = _dbData.CharId;
            this.WmId            = _dbData.WmId;
            this.ParentObjectId  = _dbData.TerrainParentId;
            this.IsOnWorldMap    = _dbData.IsOnWorldMap;
            this.CurrentWorldLoc = gameWorldData.GetWorldCoordsByWmId(_dbData.WmId);

            if (_dbData.IsOnWorldMap)
            {
                this.State = CharacterState.WorldMap;
            }

            this.ModelCode   = _dbData.ModelCode;
            this.HairstyleId = _dbData.HairstyleId;
            this.Name        = (_dbData.IsNpc ? _dbData.NpcAltName : _dbData.Name);

            CalculateMovementAsync();
        }
Ejemplo n.º 2
0
 public WorldPlaceData
 (
     ILogger logger,
     GameWorldData parent,
     List <DbTerrainObjectDefinitions> terrainObjectDefinitionList,
     int worldPosX,
     int worldPosY
 )
 {
     _logger = logger;
     _parent = parent;
     _terrainObjectDefinitionList = terrainObjectDefinitionList;
     this.WorldPosX = worldPosX;
     this.WorldPosY = worldPosY;
 }
Ejemplo n.º 3
0
        private void ClearData()
        {
            _logger = null;

            lock (_instanceLock)
            {
                foreach (PlaceInstance instance in _predefinedPlacesList)
                {
                    instance.Dispose();
                }

                foreach (PlaceInstance instance in _temporaryPlacesList)
                {
                    instance.Dispose();
                }

                _predefinedPlacesList.Clear();
                _temporaryPlacesList.Clear();
            }

            _terrainObjectDefinitionList = null; //NOTE: no Clear() method - reference given as an argument in constructor!
            _parent = null;
        }
Ejemplo n.º 4
0
 public GameWorldData(ILogger logger)
 {
     _logger = logger;
     GameWorldData._lastInstance = this;
 }