Exemple #1
0
        /// <summary>
        /// 在指定地块开始这个活动
        /// </summary>
        /// <param name="place">要开始活动的地块</param>
        internal static PlaceActing StartAt(GamePlayer player, Place place, ActionDescriptorBase action)
        {
            if (place == null)
            {
                throw new ArgumentNullException("place");
            }


            var acting = new PlaceActing
            {
                StartOn          = DateTime.UtcNow,
                ActionDescriptor = action,
                PlayerID         = player.Guid,
                Place            = place,
            };


            place.SetActing(acting);
            return(acting);
        }
Exemple #2
0
        /// <summary>
        /// 检查活动状态
        /// </summary>
        public void Check(DateTime now)
        {
            lock ( SyncRoot )
            {
                if (Place == null)
                {
                    throw new InvalidOperationException();
                }


                if (this.Equals(Place.Acting) == false)
                {
                    throw new InvalidOperationException();
                }

                if (ActionDescriptor.TryComplete(this, now))
                {
                    Place.SetActing(null);
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// 在指定地块开始这个活动
        /// </summary>
        /// <param name="place">要开始活动的地块</param>
        internal static PlaceActing StartAt( GamePlayer player, Place place, ActionDescriptorBase action )
        {
            if ( place == null )
            throw new ArgumentNullException( "place" );

              var acting = new PlaceActing
              {
            StartOn = DateTime.UtcNow,
            ActionDescriptor = action,
            PlayerID = player.Guid,
            Place = place,
              };

              place.SetActing( acting );
              return acting;
        }