Пример #1
0
        public InTransitAvatar(AvatarTransitController controller, TransitArguments transit)
        {
            _controller = controller;
            _transitArgs = transit;

            //collect the IDs of the prims we're riding on
            if (transit.RideOnGroup != null)
            {
                var primIds = transit.RideOnGroup.GetParts().Select<Scenes.SceneObjectPart, uint>(
                    (Scenes.SceneObjectPart part) => { return part.LocalId; });

                _rideOnPrims = new List<uint>(primIds);
            }

            if (transit.Type == TransitType.OutboundCrossing ||
                transit.Type == TransitType.OutboundTeleport)
            {
                _releaseEvent = new ManualResetEventSlim();
            }

            if (transit.Type == TransitType.OutboundCrossing &&
                _transitArgs.RideOnPart != null)
            {
                _objectCreationEvent = new ManualResetEventSlim();
            }
        }
Пример #2
0
        public InTransitAvatar(AvatarTransitController controller, TransitArguments transit)
        {
            _controller  = controller;
            _transitArgs = transit;

            //collect the IDs of the prims we're riding on
            if (transit.RideOnGroup != null)
            {
                var primIds = transit.RideOnGroup.GetParts().Select <Scenes.SceneObjectPart, uint>(
                    (Scenes.SceneObjectPart part) => { return(part.LocalId); });

                _rideOnPrims = new List <uint>(primIds);
            }

            if (transit.Type == TransitType.OutboundCrossing ||
                transit.Type == TransitType.OutboundTeleport)
            {
                _releaseEvent = new ManualResetEventSlim();
            }

            if (transit.Type == TransitType.OutboundCrossing &&
                _transitArgs.RideOnPart != null)
            {
                _objectCreationEvent = new ManualResetEventSlim();
            }
        }
Пример #3
0
        /// <summary>
        /// Tries to begin a transit from or to another region
        /// </summary>
        /// <param name="transit"></param>
        /// <returns>Whether or not the transit was started, or one was already in progress</returns>
        public async Task TryBeginTransit(TransitArguments transit)
        {
            InTransitAvatar transitAvatar;

            lock (_inTransitAvatars)
            {
                if (_inTransitAvatars.TryGetValue(transit.UserId, out transitAvatar))
                {
                    throw new AvatarTransitException("Avatar is already in transit");
                }

                transitAvatar = new InTransitAvatar(this, transit);
                _inTransitAvatars.Add(transit.UserId, transitAvatar);
            }

            if (transit.Type == TransitType.OutboundTeleport || transit.Type == TransitType.OutboundCrossing)
            {
                await DoBeginOutboundTransit(transitAvatar);
            }
        }
Пример #4
0
        /// <summary>
        /// Tries to begin a transit from or to another region
        /// </summary>
        /// <param name="transit"></param>
        /// <returns>Whether or not the transit was started, or one was already in progress</returns>
        public async Task TryBeginTransit(TransitArguments transit)
        {
            InTransitAvatar transitAvatar;
            lock (_inTransitAvatars)
            {
                if (_inTransitAvatars.TryGetValue(transit.UserId, out transitAvatar))
                {
                    throw new AvatarTransitException("Avatar is already in transit");
                }

                transitAvatar = new InTransitAvatar(this, transit);
                _inTransitAvatars.Add(transit.UserId, transitAvatar);
            }

            if (transit.Type == TransitType.OutboundTeleport || transit.Type == TransitType.OutboundCrossing)
            {
                await DoBeginOutboundTransit(transitAvatar);
            }
        }