本文整理汇总了C#中Camera.getViewPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Camera.getViewPosition方法的具体用法?C# Camera.getViewPosition怎么用?C# Camera.getViewPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Camera
的用法示例。
在下文中一共展示了Camera.getViewPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateAndDraw
internal void UpdateAndDraw(float a_elapsedTime, SpriteBatch a_spriteBatch, Camera a_camera, Vector2 position)
{
if (shouldUpdateAndDraw == true)
{
for (int i = 0; i < MAX_PARTICLES; i++)
{
//Update particle
allParticles.ElementAt(i).Update(a_elapsedTime, position, i);
//Check if particle is alive
if (allParticles.ElementAt(i).IsAlive())
{
//Get particle position and convert to view coordinates
Vector2 particleCenterPosition = a_camera.getViewPosition(allParticles.ElementAt(i).getParticlePostion().X, allParticles.ElementAt(i).getParticlePostion().Y - .45f, new Vector2(a_camera.getScreenWidth(), a_camera.getScreenHeight()));
float a = allParticles.ElementAt(i).getVisibility();
Color particleColor = new Color(a, a, a, a);
//Spark destination rectangle
Rectangle destinationRectangle = new Rectangle((int)particleCenterPosition.X, (int)particleCenterPosition.Y, 10, 10);
a_spriteBatch.Draw(sparkTexture, destinationRectangle, particleColor);
}
}
}
}
示例2: UpdateAndDraw
internal void UpdateAndDraw(float a_elapsedTime, SpriteBatch a_spriteBatch, Camera a_camera)
{
particleSystemTL += a_elapsedTime;
releaseTimer += a_elapsedTime;
while (releaseTimer >= releaseRate)
{
if (totalParticles < maxParticles)
{
allSmokeParticles.Add(new SmokeParticle(systemPosition, totalParticles));
totalParticles += 1;
}
releaseTimer -= releaseRate;
}
for (int index = 0; index < allSmokeParticles.Count; index++)
{
//Update particle
allSmokeParticles.ElementAt(index).Update(a_elapsedTime, systemPosition, index);
//Check if particle is alive
if (allSmokeParticles.ElementAt(index).IsAlive())
{
//Get particle position and convert to view coordinates
Vector2 particleCenterPosition = a_camera.getViewPosition(allSmokeParticles.ElementAt(index).getParticlePostion().X, allSmokeParticles.ElementAt(index).getParticlePostion().Y - .45f, new Vector2(a_camera.getScreenWidth(), a_camera.getScreenHeight()));
//Spark destination rectangle
Rectangle destinationRectangle = new Rectangle((int)particleCenterPosition.X, (int)particleCenterPosition.Y, smokeTexture.Width, smokeTexture.Height);
float a = allSmokeParticles.ElementAt(index).GetVisibility();
Color particleColor = new Color(a, a, a, a);
scale = allSmokeParticles.ElementAt(index).getScale();
rotation = allSmokeParticles.ElementAt(index).getRotation();
a_spriteBatch.Draw(smokeTexture, particleCenterPosition, null, particleColor, rotation, textureOrigin, scale, SpriteEffects.None, 0);
}
}
for (int z = 0; z < allSmokeParticles.Count; z++)
{
allSmokeParticles.ElementAt(z).Update(a_elapsedTime, systemPosition, z);
if (!allSmokeParticles.ElementAt(z).IsAlive())
{
allSmokeParticles.RemoveAt(z);
z--;
}
}
}