本文整理汇总了C#中Bullet.getPosition方法的典型用法代码示例。如果您正苦于以下问题:C# Bullet.getPosition方法的具体用法?C# Bullet.getPosition怎么用?C# Bullet.getPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bullet
的用法示例。
在下文中一共展示了Bullet.getPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: enemyBulletToPlayer
public static bool enemyBulletToPlayer(Bullet bullet, Player player)
{
float distance = (bullet.getPosition() - player.getPosistion()).Length();
if (distance < (bullet.getCollisionRadius() + player.getCollisionRadius()))
{
return true;
}
return false;
}
示例2: update
public override void update(List<Bullet> bulletList)
{
++time;
if (time % 2 == 0)
{
plus += d;
Bullet bullet;
int p=(int)(Math.Sin(MathHelper.ToRadians(plus))*3);
for (int i = 0; i < 8; ++i)
{
bullet = new Bullet(GameVariable.enemy.getPosistion() + new Vector2(100 , 0), new Rectangle(96, 176, 16, 16), new Vector2(0f, 0f),3f);
bullet.setDirection(bullet.getPosition(), GameVariable.player.getPosistion(), -105 + i * 30 + p, 5);
bulletList.Add(bullet);
bullet = new Bullet(GameVariable.enemy.getPosistion() + new Vector2(-100, 0), new Rectangle(96, 176, 16, 16), new Vector2(0f, 0f),3f);
bullet.setDirection(bullet.getPosition(), GameVariable.player.getPosistion(), -105 + i * 30 + p, 5);
bulletList.Add(bullet);
bullet = new Bullet(GameVariable.enemy.getPosistion() + new Vector2(70, 40), new Rectangle(96, 176, 16, 16), new Vector2(0f, 0f), 3f);
bullet.setDirection(bullet.getPosition(), GameVariable.player.getPosistion(), -105 + i * 30 + p, 5);
bulletList.Add(bullet);
bullet = new Bullet(GameVariable.enemy.getPosistion() + new Vector2(-70, 40), new Rectangle(96, 176, 16, 16), new Vector2(0f, 0f), 3f);
bullet.setDirection(bullet.getPosition(), GameVariable.player.getPosistion(), -105 + i * 30 + p, 5);
bulletList.Add(bullet);
}
if (plus >= 90)
d = -30;
if (plus <= -90)
d = 30;
}
if (time % 10 == 0)
{
Bullet bullet;
for (int i = 0; i < 15; i++)
{
bullet = new Bullet(GameVariable.enemy.getPosistion(), new Rectangle(16, 96, 16, 16), new Vector2(0f, 0f),2.5f);
bullet.setDirection(bullet.getPosition(), GameVariable.player.getPosistion(), -42 + i * 6, 2.5f);
bulletList.Add(bullet);
}
}
}