예제 #1
0
        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;
            }
        }
예제 #2
0
 public AddEntityAction(EnemyCopyInfo entity, ScreenDrawingSurface surface)
 {
     this.entity = entity;
     this.surface = surface;
 }
예제 #3
0
        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;
        }
예제 #4
0
        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);
        }
예제 #5
0
 public void RemoveEntity(EnemyCopyInfo info)
 {
     screen.EnemyInfo.Remove(info);
 }
예제 #6
0
 public void AddEntity(EnemyCopyInfo info)
 {
     screen.AddEnemy(info);
     Dirty = true;
 }