Exemplo n.º 1
0
        // Remove all generated visibility-obstructed waypoint edges around an entity.
        public static void RemoveAllObstructedGeneratedEdgesAround(MyEntity entity)
        {
            using(MyEntities.EntityCloseLock.AcquireSharedUsing())
            {                
                entity.UpdateAABBHr();
                BoundingBox box = entity.WorldAABBHr;
                if (box.Max - box.Min == Vector3.Zero)
                {
                    box = entity.WorldAABB;
                    if (box.Max - box.Min == Vector3.Zero)
                        return;
                }

                foreach (var edge in GetAllEdgesInBox(ref box))
                {
                    if (edge.Item1.Save && edge.Item2.Save) continue;
                    if (!edge.Item1.IsVisibleFrom(edge.Item2.Position))
                        MyWayPoint.Disconnect(edge.Item1, edge.Item2);
                }
            }
        }