public void Click(ScreenDrawingSurface surface, System.Drawing.Point location)
        {
            // select nearest entity
            var index = surface.Screen.FindEntityAt(location);
            surface.Screen.SelectEntity(index);
            surface.ReDrawEntities();

            heldEntity = surface.Screen.GetEntity(index);
            if (heldEntity != null)
            {
                entityAnchor = new Point(location.X - (int)heldEntity.screenX, location.Y - (int)heldEntity.screenY);
            }
            else
            {
                entityAnchor = Point.Empty;
            }
        }
 public AddEntityAction(EnemyCopyInfo entity, ScreenDrawingSurface surface)
 {
     this.entity = entity;
     this.surface = surface;
 }
        public EnemyCopyInfo AddEntity(Entity entity, Point location)
        {
            var info = new EnemyCopyInfo
                {
                    enemy = entity.Name,
                    screenX = location.X,
                    screenY = location.Y,
                };

            screen.AddEnemy(info);

            Dirty = true;

            return info;
        }
        private bool EntityBounded(EnemyCopyInfo entityInfo, Point location)
        {
            Entity entity = Stage.Project.EntityByName(entityInfo.enemy);
            RectangleF bounds;

            if (entity.MainSprite == null)
            {
                bounds = new RectangleF(-8, -8, 16, 16);
            }
            else
            {
                bounds = entity.MainSprite.BoundBox;
                bounds.Offset(-entity.MainSprite.HotSpot.X, -entity.MainSprite.HotSpot.Y);
            }

            bounds.Offset(entityInfo.screenX, entityInfo.screenY);
            return bounds.Contains(location);
        }
 public void RemoveEntity(EnemyCopyInfo info)
 {
     screen.EnemyInfo.Remove(info);
 }
 public void AddEntity(EnemyCopyInfo info)
 {
     screen.AddEnemy(info);
     Dirty = true;
 }