private void UpdateInventoryItems() { List <IInventoryItem> wieldedItems = player.WieldedItems; List <IInventoryItem> itemsToRemove = new List <IInventoryItem>(); foreach (IInventoryItem item in inventory) { if (wieldedItems.Contains(item)) { itemsToRemove.Add(item); } } foreach (IInventoryItem item in itemsToRemove) { inventory.Remove(item); } foreach (IInventoryItem item in player.Inventory.Where(x => !wieldedItems.Contains(x))) { if (!inventory.Contains(item)) { inventory.Add(item); } } }
/// <summary> /// Adds Rally to Playlist if not already in Playlist /// </summary> /// <param name="r">Rally which should be added to the playlist</param> public void Add(Rally r) { if (!rallyIDs.Contains(r.ID)) { rallyIDs.Add(r.ID); } }
public bool IsPointInside(TS_point point) { if (IsAVertex(point)) { return(false); } foreach (var side in Sides) { if (side.IsContain(point)) { return(false); } } TS_line horLine = new TS_line(0, point.Y); ObservableCollectionEx <TS_point> horPoints = new ObservableCollectionEx <TS_point>(); foreach (var side in Sides) { TS_point pointX = side.CrossedPoint(horLine); if (pointX.X > point.X && !horPoints.Contains(pointX)) { horPoints.Add(pointX); } } int countH = horPoints.Count; if (countH % 2 != 0) { return(true); } TS_line vertLine = new TS_line(1, 0, -point.X); List <TS_point> vertPoints = new List <TS_point>(); foreach (var side in Sides) { TS_point pointY = side.CrossedPoint(vertLine); if (pointY.Y > point.Y && !vertPoints.Contains(pointY)) { vertPoints.Add(pointY); } } int countV = vertPoints.Count; if (countV % 2 != 0) { return(true); } TS_line horLineL = new TS_line(0, point.Y); List <TS_point> horPointsL = new List <TS_point>(); foreach (var side in Sides) { TS_point pointX = side.CrossedPoint(horLineL); if (pointX.X > point.X && !horPointsL.Contains(pointX)) { horPointsL.Add(pointX); } } int countHL = horPointsL.Count; if (countHL % 2 != 0) { return(true); } List <TS_point> vertPointsD = new List <TS_point>(); foreach (var side in Sides) { TS_point pointY = side.CrossedPoint(vertLine); if (pointY.Y > point.Y && !vertPointsD.Contains(pointY)) { vertPointsD.Add(pointY); } } int countVD = vertPointsD.Count; if (countVD % 2 != 0) { return(true); } return(false); }