Beispiel #1
0
        private bool IsValid(IGameObject gameObject, List <IGameObject> objects)
        {
            if (!(-0.05 <= gameObject.X &&
                  gameObject.X + gameObject.Width < Width + 0.05 &&
                  -0.05 <= gameObject.Y &&
                  gameObject.Y + gameObject.Height < Height + 0.05))
            {
                return(false);
            }
            if (objects.Any(otherObject => !otherObject.Equals(gameObject) &&
                            AreColliding(gameObject, otherObject) &&
                            gameObject.DiesInColliding(otherObject)))
            {
                return(false);
            }

            return(true);
        }