Beispiel #1
0
        /// <summary>
        /// Gets an Id of the unit from character id.
        /// </summary>
        /// <param name="CharacterId"></param>
        /// <returns></returns>
        public bool GetUnit(int CharacterId, out RoomUnit RoomUnit)
        {
            using (DictionaryAdapter<int, RoomUnit> DA = new DictionaryAdapter<int, RoomUnit>(Units))
            {
                RoomUnit = DA.TryPopValue(GetUnitId(CharacterId));
            }

            return RoomUnit != null;
        }
Beispiel #2
0
        /// <summary>
        /// Created and adds an new player.
        /// </summary>
        /// <param name="BaseId"></param>
        /// <param name="Unit"></param>
        /// <returns></returns>
        public bool CastPlayer(int BaseId, out RoomUnit Unit)
        {
            Unit = new RoomUnit(UnitCounter.Push(), BaseId, UnitType.Player,
                new Point(Information.Model.LocationDoorX, Information.Model.LocationDoorY),
                Information.Model.LocationDoorZ,
                Information.Model.LocationDoorRotation);

            UnitLocker.EnterWriteLock();

            Units.Add(Unit.Id, Unit);

            UnitLocker.ExitWriteLock();

            return Units.ContainsKey(Unit.Id);
        }