本文整理汇总了C#中Bullet.SetRotation方法的典型用法代码示例。如果您正苦于以下问题:C# Bullet.SetRotation方法的具体用法?C# Bullet.SetRotation怎么用?C# Bullet.SetRotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bullet
的用法示例。
在下文中一共展示了Bullet.SetRotation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateBullet
//############################################################################################
//############################################################################################
public static Bullet CreateBullet(BulletType type, Vector2 position, Vector2 direction)
{
Bullet b;
switch (type)
{
case BulletType.PeaShot:
b = new Bullet(Textures.TextureName.bulletBasic);
b.LoadContent();
b.MoveTo(position);
b.speed = 0.3;
b.SetRotation(VecUtil.GetAngle(ref direction));
b.Damage = 1;
return b;
case BulletType.Round:
b = new Bullet(Textures.TextureName.bulletBasic2);
b.LoadContent();
b.MoveTo(position);
b.speed = 0.3f;
b.SetRotation(VecUtil.GetAngle(ref direction));
b.moveMethod = new MMSnakeFast(MathHelper.ToRadians(180f)/1000f, 400);
b.Damage = 1;
return b;
case BulletType.BRoundRedFast:
b = new Bullet(Textures.TextureName.bulletRedRound);
b.LoadContent();
b.MoveTo(position);
b.speed = 0.3f;
b.SetRotation(VecUtil.GetAngle(ref direction));
b.Damage = 1;
return b;
case BulletType.BRoundRedSlow:
b = new Bullet(Textures.TextureName.bulletRedRound);
b.LoadContent();
b.MoveTo(position);
b.speed = 0.3f;
b.SetRotation(VecUtil.GetAngle(ref direction));
b.Damage = 1;
return b;
case BulletType.Fatty:
b = new Bullet(Textures.TextureName.bulletFatty);
b.LoadContent();
b.MoveTo(position);
b.speed = 0.3;
b.SetRotation(VecUtil.GetAngle(ref direction));
b.Damage = 1;
return b;
}
return null;
}
示例2: RotateBullet
public void RotateBullet(Bullet bullet, Vector2 Direction)
{
Vector2 d = Direction;
d.Normalize();
bullet.SetRotation((float)Math.Atan2(-d.X, d.Y));
}