Пример #1
0
        public bool Borders(Edge edge)
        {
            var aIndex = Circumference.IndexOf(edge.A);

            if (aIndex == -1)
            {
                return(false);
            }

            var nextIndex = (aIndex + 1) % Circumference.Count;
            var prevIndex = aIndex > 0 ? aIndex - 1 : Circumference.Count - 1;

            if (Circumference[nextIndex] == edge.B || Circumference[prevIndex] == edge.B)
            {
                return(true);
            }

            return(false);
        }
Пример #2
0
        public void ReplaceWallPoint(Vector2 oldPoint, Vector2 newPoint)
        {
            var index = Circumference.IndexOf(oldPoint);

            if (index >= 0)
            {
                Circumference[index] = newPoint;
            }

            var gateIndex = Gates.IndexOf(oldPoint);

            if (gateIndex >= 0)
            {
                Gates[gateIndex] = newPoint;
            }

            var towerIndex = Towers.IndexOf(oldPoint);

            if (towerIndex >= 0)
            {
                Towers[towerIndex] = newPoint;
            }
        }