本文整理汇总了C#中System.Windows.Media.Media3D.ModelVisual3D.SetName方法的典型用法代码示例。如果您正苦于以下问题:C# ModelVisual3D.SetName方法的具体用法?C# ModelVisual3D.SetName怎么用?C# ModelVisual3D.SetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Media3D.ModelVisual3D
的用法示例。
在下文中一共展示了ModelVisual3D.SetName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateEnemy
private ModelVisual3D CreateEnemy(String EnemyType, Color EnemyColor, double x, double y, double z, double size = 1)
{
ModelVisual3D Enemy = new ModelVisual3D();
Enemy.SetName("Enemy");
Enemy.Content = CreateEnemyModel(EnemyType, EnemyColor);
Transform3DGroup Transforms = new Transform3DGroup();
Transforms.Children.Add(new ScaleTransform3D(0.01 * size, 0.01 * size, 0.01 * size));
Transforms.Children.Add(new TranslateTransform3D(x, y, z));
Enemy.Transform = Transforms;
return Enemy;
}
示例2: CreateLaser
private ModelVisual3D CreateLaser(double x, double y, double z)
{
MeshBuilder b = new MeshBuilder();
b.AddBox(new Point3D(1, 1, 1), 5, 50, 5);
var Mesh = b.ToMesh();
Material MaterialForLaser = MaterialHelper.CreateMaterial(Colors.Red);
ModelVisual3D Laser = new ModelVisual3D();
var LaserModel = new GeometryModel3D { Geometry = Mesh, Material = MaterialForLaser };
Laser.SetName("Laser");
Laser.Content = LaserModel;
Transform3DGroup Transforms = new Transform3DGroup();
Transforms.Children.Add(new ScaleTransform3D(0.01, 0.01, 0.01));
Transforms.Children.Add(new TranslateTransform3D(x, y, z));
Laser.Transform = Transforms;
return Laser;
}