System.Collections.Generic.List.Contains(int2)

Here are the examples of the csharp api System.Collections.Generic.List.Contains(int2) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

19 Source : Demo.cs
with MIT License
from sarkahn

void OnDrag(int2 p)
        {
            if (_draggedPoints.Contains(p))
                return;

            if (!_map.IsInBounds(p))
                return;

            int i = Grid2D.PosToIndex(p, _size.x);

            // Don't touch the path points
            if ((_start != null && _start.Value.Equals(p)) ||
                _end != null && _end.Value.Equals(p))
                return;

            Debug.Log($"OnDrag {p}");
            ClearPath();
            var existing = _map.GetTile(p.x, p.y);

            if (_draggedPoints.Count == 0)
            {
                _dragAdding = existing == 0;
            }

            _draggedPoints.Add(p);

            if(existing == 0)
            {
                if (_dragAdding)
                    _map.SetTile(p.x, p.y, 1);
            }
            if (existing == 1)
                if (!_dragAdding)
                    _map.SetTile(p.x, p.y, 0);

            _dirty = true;
        }

19 Source : WorldGenerator.cs
with MIT License
from TereanYu

private void addCreplacedePoint(int2 center, List<int2> heartList)
        {
            if (center.x + 1 < 11)
            {
                if (!heartList.Contains(new int2(center.x + 1, center.y)))
                {
                    heartList.Add(new int2(center.x + 1, center.y));
                }
            }
            if (center.y + 1 < 11)
            {
                if(!heartList.Contains(new int2(center.x, center.y + 1)))
                {
                    heartList.Add(new int2(center.x, center.y + 1));
                }
            }
            if (center.x - 1 >= 0)
            {
                if (!heartList.Contains(new int2(center.x - 1, center.y)))
                {
                    heartList.Add(new int2(center.x - 1, center.y));
                }
            }
            if (center.y - 1 >= 0)
            {
                if (!heartList.Contains(new int2(center.x, center.y - 1)))
                {
                    heartList.Add(new int2(center.x, center.y - 1));
                }
            }
        }