Ejemplo n.º 1
0
        public bool SpawnIsAcceptable(Spawn spawn)
        {
            const int limit  = 100; // Distance to nearest Trail
            var       trails = GetTrails();

            var aheadX = spawn.GetPos().X + (limit * spawn.GetDir().X);
            var aheadY = spawn.GetPos().Y + (limit * spawn.GetDir().Y);

            var line = new LineSegment2D(spawn.GetPos(), new Vector2(aheadX, aheadY));

            foreach (var segment in trails)
            {
                if (line.Intersects(segment.GetLine()))
                {
                    return(false);
                }
            }

            return(true);
        }