本文整理汇总了C#中Sprite.Start方法的典型用法代码示例。如果您正苦于以下问题:C# Sprite.Start方法的具体用法?C# Sprite.Start怎么用?C# Sprite.Start使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sprite
的用法示例。
在下文中一共展示了Sprite.Start方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ChangeColorIfTwoRectanglesCollide
public void ChangeColorIfTwoRectanglesCollide()
{
var sprite = new Sprite(material, new Rectangle(0.25f, 0.2f, 0.5f, 0.5f));
sprite.Start<CollisionTrigger>().Add(new CollisionTrigger.Data(Color.Yellow, Color.Blue));
sprite.Get<CollisionTrigger.Data>().SearchTags.Add("Creep");
var sprite2 = new Sprite(material, new Rectangle(0.5f, 0.2f, 0.1f, 0.5f));
sprite2.AddTag("Creep");
}
示例2: ChangeColorTwiceASecond
public void ChangeColorTwiceASecond()
{
var sprite = new Sprite(material, Rectangle.HalfCentered)
{
Color = Color.Green
};
sprite.Start<TimeTrigger>().Add(new TimeTrigger.Data(Color.Green, Color.Gold, 0.2f));
AdvanceTimeAndUpdateEntities(0.03f);
AdvanceTimeAndUpdateEntities(0.2f);
}
示例3: UseSpriteAsFarPlanetBackground
public void UseSpriteAsFarPlanetBackground()
{
Create3DCamera();
var sprite = new Sprite(new Material(ShaderFlags.Position2DColoredTextured, "DeltaEngineLogo"),
new Rectangle(0, 0, 1, 1));
sprite.RenderLayer = -1;
sprite.UV = new Rectangle(0.25f, 0.25f, 0.7f, 0.7f);
new Model(new ModelData(new BoxMesh(0.1f * Vector3D.One, Color.Red)), Vector3D.Zero);
sprite.Start<BackgroundUVUpdater>();
}
示例4: CreateTrigger
public void CreateTrigger()
{
var trigger = new Sprite(material, new Rectangle(Vector2D.Zero, (Size)Vector2D.One))
{
Color = Color.Red
};
trigger.Add(new TimeTrigger.Data(Color.Red, Color.Gray, 1));
trigger.Start<CollisionTrigger>().Add(new CollisionTrigger.Data(Color.White, Color.Red));
Assert.AreEqual(Vector2D.Zero, trigger.Get<Rectangle>().TopLeft);
Assert.AreEqual(Vector2D.One, trigger.Get<Rectangle>().BottomRight);
}
示例5: RenderSlowlyFallingLogo
public void RenderSlowlyFallingLogo()
{
var sprite = new Sprite(new Material(ShaderFlags.Position2DTextured, "DeltaEngineLogo"),
screenCenter);
sprite.Add(new SimplePhysics.Data
{
Velocity = new Vector2D(0.0f, -0.3f),
RotationSpeed = 100.0f,
Gravity = new Vector2D(0.0f, 0.1f),
});
sprite.Color = Color.Red;
sprite.Start<SimplePhysics.Move>();
}
示例6: CreateFallingSpriteWhichExpires
private static Sprite CreateFallingSpriteWhichExpires()
{
var sprite = new Sprite(new Material(ShaderFlags.Position2DTextured, "DeltaEngineLogo"),
Rectangle.One);
sprite.Add(new SimplePhysics.Data
{
Velocity = Vector2D.Half,
Gravity = new Vector2D(1.0f, 2.0f),
Duration = 1.0f
});
sprite.Start<SimplePhysics.Move>();
sprite.Color = Color.Red;
return sprite;
}
示例7: AddFallingBrick
} //ncrunch: no coverage end
private static void AddFallingBrick(Entity2D brick, Material material)
{
var fallingBrick = new Sprite(material, brick.DrawArea)
{
Color = brick.Color,
RenderLayer = (int)BlocksRenderLayer.FallingBrick,
};
var random = Randomizer.Current;
var data = new SimplePhysics.Data
{
Velocity = new Vector2D(random.Get(-0.5f, 0.5f), random.Get(-1.0f, 0.0f)),
RotationSpeed = random.Get(-360, 360),
Duration = 5.0f,
Gravity = new Vector2D(0.0f, 2.0f)
};
fallingBrick.Add(data);
fallingBrick.Start<SimplePhysics.Move>();
}
示例8: KillSpriteAfterTimeout
public void KillSpriteAfterTimeout()
{
var enemyMovingOutOfScreen =
new Sprite(new Material(ShaderFlags.Position2DTextured, "DeltaEngineLogo"),
new Rectangle(Vector2D.Half, new Size(0.1f)));
var data = new SimplePhysics.Data { Velocity = new Vector2D(0.5f, 0), Duration = 1 };
enemyMovingOutOfScreen.Add(data);
enemyMovingOutOfScreen.Start<SimplePhysics.Move>();
enemyMovingOutOfScreen.Start<SimplePhysics.KillAfterDurationReached>();
if (IsMockResolver)
AdvanceTimeAndUpdateEntities(1.1f);
}
示例9: AddBehaviorRemovedPreviously
public void AddBehaviorRemovedPreviously()
{
var sprite = new Sprite("DeltaEngineLogoAlpha", new Rectangle(0.0f, 0.0f, 0.1f, 0.1f));
sprite.Start<SimpleSizeUpdater>();
AdvanceTimeAndUpdateEntities();
sprite.Start<SimpleSizeUpdater>();
AdvanceTimeAndUpdateEntities();
Assert.That(sprite.Size.IsNearlyEqual(new Size(0.4f)));
}
示例10: RenderPanAndZoomIntoLogo
public void RenderPanAndZoomIntoLogo()
{
ScreenSpace.Current = new Camera2DScreenSpace(Resolve<Window>());
var logo = new Sprite(logoMaterial, Rectangle.FromCenter(Vector2D.One, new Size(0.25f)));
logo.Start<PanAndZoom>();
}