public bool ContainsCharacter(Character character)
 {
     lock(this.movablecache)
     {
         return this.movablecache.Contains (character);
     }
 }
 public void AddToProvider(Character character)
 {
     lock(this.movablecache)
     {
         this.movablecache.Add (character);
     }
 }
        private bool MoveTileBased(Character movable, List<Character> collided)
        {
            bool movedok = true;
            float x = movable.Location.X;
            float y = movable.Location.Y;

            #region Destination calculation
            if(movable.Direction == Directions.North)
            {
                y -= movable.Speed;
            }
            else if(movable.Direction == Directions.South)
            {
                y += movable.Speed;
            }
            else if(movable.Direction == Directions.East)
            {
                x += movable.Speed;
            }
            else if(movable.Direction == Directions.West)
            {
                x -= movable.Speed;
            }
            #endregion

            movable.Location = new ScreenPoint ((int) x, (int) y);

            return movedok;
        }
        private bool MoveDestinationBased(Character movable, List<Character> collided, float speedmodifier)
        {
            bool movedok = true;

            float x = movable.Location.X;
            float y = movable.Location.Y;
            float speed = movable.Speed * speedmodifier;

            if(x < movable.MovingDestination.X)
            {
                if(x + speed > movable.MovingDestination.X)
                    x = movable.MovingDestination.X;
                else
                    x += speed;
            }
            else if(x > movable.MovingDestination.X)
            {
                if(x + speed < movable.MovingDestination.X)
                    x = movable.MovingDestination.X;
                else
                    x -= speed;
            }

            if(y > movable.MovingDestination.Y)
            {
                if(y - speed < movable.MovingDestination.Y)
                    y = movable.MovingDestination.Y;
                else
                    y -= speed;
            }
            else if(y < movable.MovingDestination.Y)
            {
                if(y + speed > movable.MovingDestination.Y)
                    y = movable.MovingDestination.Y;
                else
                    y += speed;
            }

            ScreenPoint destination = new ScreenPoint ((int) x, (int) y);

            movable.Location = destination;

            if(destination == movable.MovingDestination)
                movedok = false;

            return movedok;
        }
 private ScreenPoint GetDestinationFromDirection(Character movable, Directions direction)
 {
     return this.GetDestinationFromDirection (movable.Location, direction);
 }
 public MovementChangedEventArgs(Character character, MovementStage stage, ScreenPoint location)
 {
     this.Character = character;
     this.Stage = stage;
     this.location = location;
 }
 public bool RemoveFromProvider(Character character)
 {
     lock(this.movablecache)
     {
         return this.movablecache.Remove (character);
     }
 }
 public ScreenPoint GetNextScreenPointTile(Character movable)
 {
     return this.GetNextScreenPointTile (movable.Location, movable.Direction);
 }
        public void EndMoveLocation(Character movable, MapPoint destination, string animationname)
        {
            //lock(this.movablecache)
            //{
            //    if(!this.movablecache.ContainsKey (movable))
            //        return;

            //    this.movablecache[movable].Enqueue (new MovementItem (destination.ToScreenPoint (), MovementType.Destination, Directions.Any, animationname));
            //}
        }
        public void BeginMove(Character movable, Directions direction, string animationname)
        {
            //this.AddToCache (movable, new MovementItem (ScreenPoint.Zero, MovementType.TileBased, direction, animationname));

            //movable.OnStartedMoving (this, EventArgs.Empty);
        }
 private void SaveCharacter(Character character)
 {
     ISession session = this.sessionfactory.OpenSession ();
     session.SaveOrUpdate(character);
     session.Flush();
     session.Close ();
 }