internal void ClearTile() { if (inScreen) { cursor.Selected.SetTileType(TileType.None); cursor.Selected.ClearSource(); Point mousePosition = MouseManager.Instance.Position; for (int i = mapInfo.EnemyObjects.Count - 1; i >= 0; i--) { EnemyObjectInfo enmObj = mapInfo.EnemyObjects[i]; if (cursor.Selected.Destination.Intersects(enmObj.Destination)) { mapInfo.EnemyObjects.Remove(enmObj); } } for (int i = mapInfo.MapObjects.Count - 1; i >= 0; i--) { MapObject mapObj = mapInfo.MapObjects[i]; if (cursor.Selected.Destination.Intersects(mapObj.DestinationBox)) { mapInfo.MapObjects.Remove(mapObj); } } } }
internal EnemyObjectInfo Clone() { EnemyObjectInfo newObject = new EnemyObjectInfo(); newObject.source = new Rectangle(this.source.X, this.source.Y, this.source.Width, this.Source.Height); newObject.Type = type; return(newObject); }
internal void SetEnemy(EnemyObjectInfo _enemyObjectInfo) { if (inScreen) { Point mousePosition = MouseManager.Instance.Position; Vector2 tilePositionCursor = mousePosition.ToVector2() - this.Position; int tileX = tilePositionCursor.X < 0 ? -1 : (int)(tilePositionCursor.X / mapInfo.TileWidth) + viewSizeStartX; int tileY = tilePositionCursor.Y < 0 ? -1 : (int)(tilePositionCursor.Y / mapInfo.TileHeight) + viewSizeStartY; Rectangle destination = new Rectangle((int)(tileX * mapInfo.TileWidth), (int)(tileY * mapInfo.TileHeight), _enemyObjectInfo.Source.Width, _enemyObjectInfo.Source.Height); _enemyObjectInfo.Destination = destination; mapInfo.AddEnemy(_enemyObjectInfo); } }