当前位置: 首页>>代码示例>>C#>>正文


C# ShapeCollection类代码示例

本文整理汇总了C#中ShapeCollection的典型用法代码示例。如果您正苦于以下问题:C# ShapeCollection类的具体用法?C# ShapeCollection怎么用?C# ShapeCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ShapeCollection类属于命名空间,在下文中一共展示了ShapeCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SortShapesIntoZonesAction

        public SortShapesIntoZonesAction(ShapeCollection shapes, ZoneCollection zones)
            : base("Sort shapes into zones")
        {
            _zones = zones;
              if (_zones == null)
            _zones = EditorManager.Scene.Zones;

              foreach (ShapeBase shape in shapes)
              {
            Layer layer = GetBestLayer(shape);
            bool bIsExternalLayer = !EditorManager.Scene.Layers.Contains(shape.ParentLayer);

            if (layer == shape.ParentLayer) // do not re-assign, just leave in the layer
              continue;
            if (layer == null)
            {
              layer = GetBestLayer(shape); // see again why this failed (debug)
              layer = GetUnAssignedLayer(shape);
            }

            if (bIsExternalLayer)
            {
              shape.ChildIndex = -1;
              this.Add(AddShapeAction.CreateAddShapeAction(shape, layer.Root, layer, false));
            }
            else
              this.Add(new SetShapeParentAction(shape, layer.Root));
              }
        }
开发者ID:romance-ii,项目名称:projectanarchy,代码行数:29,代码来源:SortShapesIntoZonesAction.cs

示例2: Decorator

 public Decorator()
     : base(ControlTag + (++count), string.Empty)
 {
     IsFocusable = false;
     CanRaiseEvents = false;
     Shapes = new ShapeCollection(1);
 }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:7,代码来源:Decorator.cs

示例3: IsInLineOfSight

        public static bool IsInLineOfSight(Vector3 position1, Vector3 position2, float collisionThreshold, ShapeCollection shapeCollection)
        {
            Segment segment = new Segment(new FlatRedBall.Math.Geometry.Point(ref position1),
                new FlatRedBall.Math.Geometry.Point(ref position2));

            for(int i = 0; i < shapeCollection.Polygons.Count; i++)
            {
                Polygon polygon = shapeCollection.Polygons[i];

                if (polygon.CollideAgainst(segment) ||
                    (collisionThreshold > 0 && segment.DistanceTo(polygon) < collisionThreshold))
                {
                    return false;
                }
            }

            for (int i = 0; i < shapeCollection.AxisAlignedRectangles.Count; i++)
            {
                AxisAlignedRectangle rectangle = shapeCollection.AxisAlignedRectangles[i];

                FlatRedBall.Math.Geometry.Point throwaway;

                if (rectangle.Intersects(segment, out throwaway) ||
                    (collisionThreshold > 0 && segment.DistanceTo(rectangle) < collisionThreshold))
                {
                    return false;
                }
            }

            for (int i = 0; i < shapeCollection.Circles.Count; i++)
            {
                Circle circle = shapeCollection.Circles[i];               

                if (segment.DistanceTo(circle) < collisionThreshold)
                {
                    return false;
                }
            }

#if DEBUG
            if (shapeCollection.Capsule2Ds.Count != 0)
            {
                throw new Exception("IsInLineOfSight does not support ShapeCollections with Capsule2Ds");
            }
#endif

            for (int i = 0; i < shapeCollection.Lines.Count; i++)
            {
                Line line = shapeCollection.Lines[i];

                if (segment.DistanceTo(line.AsSegment()) < collisionThreshold)
                {
                    return false;
                }
            }

            return true;

        }
开发者ID:vchelaru,项目名称:FlatRedBall,代码行数:59,代码来源:PathfindingFunctions.cs

示例4: DropToFloorAction

 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="shapes"></param>
 /// <param name="mode"></param>
 /// <param name="includeShapes"></param>
 public DropToFloorAction(ShapeCollection shapes, Shape3D.DropToFloorMode mode, Vector3F axis, bool includeShapes)
     : base("Drop to Floor")
 {
     _shapes = shapes;
       _mode = mode;
       _axis = axis;
       _includeShapes = includeShapes;
 }
开发者ID:hxzpily,项目名称:projectanarchy,代码行数:14,代码来源:DropToFloorAction.cs

示例5: ShapeContainer

 public ShapeContainer()
 {
     ShapeType = RoundedBox.Creator;
     LineType = Line.Creator;
     ShapeList = new ShapeCollection ();
     back = new Bitmap (Width, Height);
     current = new Bitmap (Width, Height);
     InitializeComponent ();
 }
开发者ID:miniBill,项目名称:DiagramDrawer,代码行数:9,代码来源:ShapeContainer.cs

示例6: ControlSelector

 public ControlSelector()
     : base(ControlTag + ++count, ControlTag)
 {
     ApplyControlDescription(StyleManager.GetControlDescription(ControlTag));
     ApplyStatusChanges = false;
     handleSize = new Size(12, 12);
     sensibleArea = new Size(handleSize.Width, handleSize.Height);
     Shapes = new ShapeCollection(8);
 }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:9,代码来源:ControlSelector.cs

示例7: DecoratorButton

 public DecoratorButton()
     : base(ControlTag + (++count), ControlTag)
 {
     IsFocusable = false;
     Shapes = new ShapeCollection(2);
     decorator = new Decorator
                     {
                         Parent = this,
                         DecorationType = DecorationType.DownsideTriangle,
                     };
 }
开发者ID:yong-ja,项目名称:starodyssey,代码行数:11,代码来源:DecoratorButton.cs

示例8: SpriterObject

        public SpriterObject(string contentManagerName, bool addToManagers)
        {
            LayerProvidedByContainer = null;
            Animating = false;
            SecondsIn = 0f;
            CurrentKeyFrameIndex = 0;
            ScaleX = 1.0f;
            ScaleY = 1.0f;
            Animations = new Dictionary<string, SpriterObjectAnimation>(1);

            ContentManagerName = contentManagerName;
            InitializeSpriterObject(addToManagers);
            ObjectList = new List<PositionedObject>();
            CollisionBoxes = new ShapeCollection();
        }
开发者ID:kainazzzo,项目名称:flatredball-spriter,代码行数:15,代码来源:SpriterObject.cs

示例9: Save

        /// <summary>
        /// Overridden save function
        /// </summary>
        /// <param name="filename"></param>
        /// <returns></returns>
        public override bool Save(string filename)
        {
            PrefabDesc prefab = new PrefabDesc(filename);
              ShapeCollection all = new ShapeCollection();

              // the following shapes go into the prefab: lightgrid boxes, lights
              foreach (ShapeBase shape in this.FilteredSupplier)
            all.Add(shape);

              foreach (ShapeBase shape in this.FilteredLights)
            if (!all.Contains(shape))
              all.Add(shape);

              if (!prefab.CreateFromInstances(all, Vector3F.Zero, false, false))
            return false;
              return prefab.SaveToFile(null);
        }
开发者ID:romance-ii,项目名称:projectanarchy,代码行数:22,代码来源:VisionLightInfo.cs

示例10: reportlist_DoubleClick

        private void reportlist_DoubleClick(object sender, System.EventArgs e)
        {
            ShapeBase shape = (ShapeBase)reportlist.SelectedItems[0].Tag;
              ShapeCollection shapes = new ShapeCollection();
              shapes.Add(shape);

              EditorManager.SelectedShapes = shapes;

              //jump to selection
              BoundingBox mergedBox = EditorManager.SelectedShapes.BoundingBox;
              if (!mergedBox.Valid)
            return;

              // make it local again
              Vector3F center = mergedBox.Center;
              mergedBox.Translate(-center);

              EditorManager.ActiveView.LookAt(center, mergedBox);
        }
开发者ID:hxzpily,项目名称:projectanarchy,代码行数:19,代码来源:ExportReportDlg.cs

示例11: Model

        public Model()
        {
            mAmbience = new Ambience(this);
            //listen to events
            AttachToAmbience(mAmbience);

            //here I'll have to work on the scene graph
            this.mShapes = new ShapeCollection();

            //the page collection
            mPages = new CollectionBase<IPage>();

            //the default page
            mDefaultPage = new Page("Default Page");
            mDefaultPage.OnEntityAdded += new EventHandler<EntityEventArgs>(mDefaultPage_OnEntityAdded);
            mDefaultPage.OnEntityRemoved += new EventHandler<EntityEventArgs>(mDefaultPage_OnEntityRemoved);
            mDefaultPage.OnClear += new EventHandler(mDefaultPage_OnClear);
            mPages.Add(mDefaultPage);
            //initially the current page is the one and only default page
            mCurrentPage = mDefaultPage;

            //the paintables
            mPaintables = new CollectionBase<IDiagramEntity>();
        }
开发者ID:Tom-Hoinacki,项目名称:OO-CASE-Tool,代码行数:24,代码来源:Model.cs

示例12: MigrateToFmodShapes

        /// <summary>
        /// This function converts all shapes from the old SoundPlugin to the corresponding shapes of the new FmodPlugin
        /// </summary>
        void MigrateToFmodShapes()
        {
            // If old Sound plugin is not loaded, don't do anything
              IEditorPluginModule soundPlugin = EditorManager.GetPluginByName("SoundEditorPlugin.EditorPlugin");
              if (soundPlugin == null || !soundPlugin.Initialized)
            return;

              // collect all sound specific shapes
              ShapeCollection soundShapes = new ShapeCollection();
              foreach (Layer layer in EditorManager.Scene.Layers)
            if (layer.Modifiable && layer.Loaded)
              AddSoundShapesRecursive(soundShapes, layer.Root);

              if (soundShapes.Count == 0)
            return;

              // prompt a dialog
              DialogResult res = EditorManager.ShowMessageBox("Shapes from old Sound Plugin have been found in loaded layers.\n\nShould these be permanently converted to the corresponding shapes of the Fmod Plugin?", "Old Sound Plugin and Fmod Plugin are both loaded", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
              if (res != DialogResult.Yes)
            return;

              ShapeCollection newShapes = new ShapeCollection();
              int iConvertedCount = 0;
              if (soundShapes.Count > 0)
              {
            GroupAction actions = new GroupAction("Migrate Sound shapes");
            foreach (ShapeObject3D oldShape in soundShapes)
            {
              ShapeObject3D newShape = null;
              if (oldShape.GetType().FullName == "SoundEditorPlugin.SoundShape")
              {
            newShape = new FmodSoundShape(oldShape.ShapeName);
            MigrateSoundShapeProperties(oldShape, (FmodSoundShape)newShape);

            actions.Add(AddShapeAction.CreateAddShapeAction(newShape, oldShape.Parent, oldShape.ParentLayer, false));

            actions.Add(new MigrateSoundLinksAction(oldShape, (FmodSoundShape)newShape));
            actions.Add(new MigrateChildrenAction(oldShape, newShape));
            actions.Add(RemoveShapeAction.CreateRemoveShapeAction(oldShape));
            newShapes.Add(newShape);
              }
              else if (oldShape.GetType().FullName == "SoundEditorPlugin.SoundCollisionShape")
              {
            newShape = new FmodCollisionMeshShape(oldShape.ShapeName);
            MigrateSoundCollisionShapeProperties(oldShape, (FmodCollisionMeshShape)newShape);

            actions.Add(AddShapeAction.CreateAddShapeAction(newShape, oldShape.Parent, oldShape.ParentLayer, false));
            actions.Add(new MigrateChildrenAction(oldShape, newShape));
            actions.Add(RemoveShapeAction.CreateRemoveShapeAction(oldShape));
            newShapes.Add(newShape);
              }
              if (newShape == null)
            continue;

              iConvertedCount++;
            }

            // EditorManager.Actions.Add() is not used, in order to prevent a undo of the conversion
            actions.Do();
              }

              // ensure, that all migrated childs have valid engine instances
              foreach (ShapeBase shape in newShapes)
            foreach (ShapeBase child in shape.ChildCollection)
              child.ReCreateEngineInstance(true);

              EditorManager.ShowMessageBox(iConvertedCount.ToString() + " Shape(s) have been successfully converted.", "Sound to Fmod shapes conversion", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:71,代码来源:FmodEditorPlugin.cs

示例13: BuildNavMesh_Click

        /// <summary>
        /// Build nav mesh button
        /// </summary>
        private void BuildNavMesh_Click(object sender, EventArgs e)
        {
            CSharpFramework.Scene.ZoneCollection zones = EditorManager.Scene.Zones.ShallowClone();
              GroupAction groupLoadAction = new GroupAction("Load all zones");

              foreach (CSharpFramework.Scene.Zone zone in zones)
            groupLoadAction.Add(new CSharpFramework.Actions.SetZoneLoadedStatusAction(zone, true));
              groupLoadAction.Do();

              {
            // for printing out stats
            BuildStatisticsRichTextBox.ScrollBars = RichTextBoxScrollBars.ForcedVertical;
            Font oldFont = BuildStatisticsRichTextBox.SelectionFont;
            Font newFontPlain = new Font(oldFont, oldFont.Style & ~FontStyle.Bold);
            Font newFontBold = new Font(oldFont, oldFont.Style | FontStyle.Bold);

            ShapeCollection navMeshShapes = EditorManager.Scene.AllShapesOfType(typeof(HavokNavMeshShape));

            // gather all geometry once (divide by zone later)
            ShapeCollection staticGeometries = new ShapeCollection();
            {
              int numEntities = 0, numStaticMeshes = 0, numTerrains = 0;
              int numCarvers = 0, numSeedPoints = 0, numLocalSettings = 0;
              gatherGeometricShapes(ref staticGeometries, ref numEntities, ref numStaticMeshes, ref numTerrains, ref numCarvers, ref numSeedPoints, ref numLocalSettings);

              //
              // print out some debug info
              //
              BuildStatisticsRichTextBox.SelectionStart = BuildStatisticsRichTextBox.Text.Length;
              {
            String inputGeometryLabel = "Input Geometry";
            BuildStatisticsRichTextBox.Text = inputGeometryLabel;
              }
              BuildStatisticsRichTextBox.SelectionLength = BuildStatisticsRichTextBox.Text.Length - BuildStatisticsRichTextBox.SelectionStart;
              BuildStatisticsRichTextBox.SelectionFont = newFontBold;

              {
            String inputGlobalGeometryInfo = "\n\nStatic meshes\t: " + numStaticMeshes + "\nTerrains\t\t: " + numTerrains + "\nEntities\t\t: " + numEntities +
                "\n\nCarvers\t\t: " + numCarvers + "\nSeed points\t: " + numSeedPoints + "\nLocal settings\t: " + numLocalSettings + "\n\n";
            BuildStatisticsRichTextBox.Text += inputGlobalGeometryInfo;
              }
              BuildStatisticsRichTextBox.SelectionLength = BuildStatisticsRichTextBox.Text.Length - BuildStatisticsRichTextBox.SelectionStart;
              BuildStatisticsRichTextBox.SelectionFont = newFontPlain;

              //
              // debug info end
              //
            }

            // actually build the navmeshes here
            int numBuiltNavMeshShapes = 0;
            bool allCompleted = true;
            foreach (HavokNavMeshShape shape in navMeshShapes)
            {
              int numGeometryVertices = 0, numGeometryTriangles = 0;

              // note that the build function only uses static geometries that lie in the same zone!
              bool built = shape.Build(staticGeometries, ref numGeometryVertices, ref numGeometryTriangles);

              if (built)
              {
            numBuiltNavMeshShapes++;

            //
            // print out some debug info
            //
            BuildStatisticsRichTextBox.SelectionStart = BuildStatisticsRichTextBox.Text.Length;
            {
              String navMeshLabel = "\n\nNav Mesh #" + numBuiltNavMeshShapes;
              BuildStatisticsRichTextBox.Text += navMeshLabel;
            }
            BuildStatisticsRichTextBox.SelectionLength = BuildStatisticsRichTextBox.Text.Length - BuildStatisticsRichTextBox.SelectionStart;
            BuildStatisticsRichTextBox.SelectionFont = newFontBold;

            BuildStatisticsRichTextBox.SelectionStart = BuildStatisticsRichTextBox.Text.Length;
            {
              String inputPerNavMeshGeometryInfo = "\nTotal input triangles\t: " + numGeometryTriangles + "\nTotal input vertices\t: " + numGeometryVertices + "\n\n";
              int facesSize = shape.GetNavMeshFaceSize() * shape.GetNumNavMeshFaces();
              int edgesSize = shape.GetNavMeshEdgeSize() * shape.GetNumNavMeshEdges();
              int verticesSize = shape.GetNavMeshVertexSize() * shape.GetNumNavMeshVertices();
              int totalSize = shape.GetNavMeshStructSize() + facesSize + edgesSize + verticesSize;

              String navMeshInfo = "\nTotal size\t\t: " + totalSize +
                  " bytes\nFaces ( " + shape.GetNumNavMeshFaces() + " )\t: " + facesSize +
                  "\nEdges ( " + shape.GetNumNavMeshEdges() + " )\t: " + edgesSize +
                  "\nVertices ( " + shape.GetNumNavMeshVertices() + " )\t: " + verticesSize;
              BuildStatisticsRichTextBox.Text += navMeshInfo;
            }
            BuildStatisticsRichTextBox.SelectionLength = BuildStatisticsRichTextBox.Text.Length - BuildStatisticsRichTextBox.SelectionStart;
            BuildStatisticsRichTextBox.SelectionFont = newFontPlain;

            //
            // debug info end
            //
              }
              else
              {
//.........这里部分代码省略.........
开发者ID:romance-ii,项目名称:projectanarchy,代码行数:101,代码来源:HavokAiPanel.cs

示例14: LoadStaticContent

 public static void LoadStaticContent(string contentManagerName)
 {
     ContentManagerName = contentManagerName;
     #if DEBUG
     if (contentManagerName == FlatRedBallServices.GlobalContentManager)
     {
         HasBeenLoadedWithGlobalContentManager = true;
     }
     else if (HasBeenLoadedWithGlobalContentManager)
     {
         throw new Exception("This type has been loaded with a Global content manager, then loaded with a non-global.  This can lead to a lot of bugs");
     }
     #endif
     if (IsStaticContentLoaded == false)
     {
         IsStaticContentLoaded = true;
         lock (mLockObject)
         {
             if (!mHasRegisteredUnload && ContentManagerName != FlatRedBallServices.GlobalContentManager)
             {
                 FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("PlayerStaticUnload", UnloadStaticContent);
                 mHasRegisteredUnload = true;
             }
         }
         bool registerUnload = false;
         if (!FlatRedBallServices.IsLoaded<FlatRedBall.Math.Geometry.ShapeCollection>(@"content/entities/player/shapecollectionfile.shcx", ContentManagerName))
         {
             registerUnload = true;
         }
         ShapeCollectionFile = FlatRedBallServices.Load<FlatRedBall.Math.Geometry.ShapeCollection>(@"content/entities/player/shapecollectionfile.shcx", ContentManagerName);
         if (!FlatRedBallServices.IsLoaded<Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/player/mech.png", ContentManagerName))
         {
             registerUnload = true;
         }
         mech = FlatRedBallServices.Load<Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/player/mech.png", ContentManagerName);
         if (!FlatRedBallServices.IsLoaded<Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/player/redball.bmp", ContentManagerName))
         {
             registerUnload = true;
         }
         redball = FlatRedBallServices.Load<Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/player/redball.bmp", ContentManagerName);
         if (!FlatRedBallServices.IsLoaded<FlatRedBall.ManagedSpriteGroups.SpriteRig>(@"content/entities/player/ballman.srgx", ContentManagerName))
         {
             registerUnload = true;
         }
         ballMan = FlatRedBallServices.Load<FlatRedBall.ManagedSpriteGroups.SpriteRig>(@"content/entities/player/ballman.srgx", ContentManagerName);
         if (registerUnload && ContentManagerName != FlatRedBallServices.GlobalContentManager)
         {
             lock (mLockObject)
             {
                 if (!mHasRegisteredUnload && ContentManagerName != FlatRedBallServices.GlobalContentManager)
                 {
                     FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("PlayerStaticUnload", UnloadStaticContent);
                     mHasRegisteredUnload = true;
                 }
             }
         }
         CustomLoadStaticContent(contentManagerName);
     }
 }
开发者ID:WillPetro,项目名称:Prototype,代码行数:59,代码来源:Player.Generated.cs

示例15: gatherGeometricShapes

        public static void gatherGeometricShapes(ref ShapeCollection shapesOut, ref int numEntitiesOut, ref int numStaticMeshesOut, ref int numTerrainsOut, ref int numCarversOut, ref int numSeedPointsOut, ref int numLocalSettingsOut)
        {
            // Grab all shapes from all layers
              foreach (Layer layer in EditorManager.Scene.Layers)
              {
            if (layer.GetIncludeInNavMesh())
            {
              recursivelyAddShapes(layer.Root.ChildCollection, ref shapesOut);
            }
              }

              // calculate some statistics
              foreach (ShapeBase shape in shapesOut)
              {
            // check if the shape to be added is in the same zone as the HavokNavMeshShape's parentZone
            // note that if HavokNavMeshShape is not in a zone, then it will only include other shapes that aren't in zones also.

            Shape3D shape3d = shape as Shape3D;
            Shape3D.eNavMeshUsage usage = shape3d.GetNavMeshUsage();
            if (usage != Shape3D.eNavMeshUsage.ExcludeFromNavMesh)
            {
              if (shape is EntityShape)
              {
            numEntitiesOut++;
              }
              else if (shape is StaticMeshShape)
              {
            numStaticMeshesOut++;
              }
              else if (shape is TerrainShape)
              {
            numTerrainsOut++;
              }
            }
              }

              ShapeCollection carvers = EditorManager.Scene.AllShapesOfType(typeof(HavokNavMeshCarverShape));
              numCarversOut = carvers.Count;

              ShapeCollection seedPoints = EditorManager.Scene.AllShapesOfType(typeof(HavokNavMeshSeedPointShape));
              numSeedPointsOut = seedPoints.Count;

              // Add local settings
              ShapeCollection localSettings = EditorManager.Scene.AllShapesOfType(typeof(HavokNavMeshLocalSettingsShape));
              numLocalSettingsOut = localSettings.Count;
        }
开发者ID:romance-ii,项目名称:projectanarchy,代码行数:46,代码来源:HavokAiPanel.cs


注:本文中的ShapeCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。