Ejemplo n.º 1
0
        public void SpecialPointsEquateIfTheirPositionsEquateTest()
        {
            var point1 = new SpecialPoint(testPosition);
            var point2 = new SpecialPoint(testPosition);

            Assert.Equal(point1, point2);
        }
Ejemplo n.º 2
0
        public void SpecialPointsDoNotEquateIfTheirPositionsDoNotEquateTest()
        {
            var point1 = new SpecialPoint(testPosition);
            var point2 = new SpecialPoint(Vector2Int.ZeroVector);

            Assert.NotEqual(point1, point2);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Attempts to remove a special point at the given location.
        /// </summary>
        /// <param name="in_point">The location of the special point to remove.</param>
        /// <returns><c>true</c>, if the point was not found or if it was found and removed, <c>false</c> otherwise.</returns>
        private bool TryRemoveSpecialPoint(SpecialPoint in_point)
        {
            var result = false;

            if (null != in_point &&
                IsValidPosition(in_point.Position))
            {
                // Return true if the point was removed or if the point never existed.
                result = _specialPoints.Remove(in_point) ||
                         !_specialPoints.Exists(in_foundPoint =>
                                                in_foundPoint.GetType() == in_point.GetType() && in_foundPoint == in_point);
            }

            return(result);
        }