本文整理匯總了C#中Terraria.Player.RotatedRelativePoint方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.RotatedRelativePoint方法的具體用法?C# Player.RotatedRelativePoint怎麽用?C# Player.RotatedRelativePoint使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Terraria.Player
的用法示例。
在下文中一共展示了Player.RotatedRelativePoint方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Shoot
public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Vector2 relativeCenter = player.RotatedRelativePoint(player.MountedCenter, true);
float num5 = player.inventory[player.selectedItem].shootSpeed * item.scale;
Vector2 vector2_3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - relativeCenter;
if ((double)player.gravDir == -1.0)
vector2_3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - relativeCenter.Y;
Vector2 vector2_4 = Vector2.Normalize(vector2_3);
if (float.IsNaN(vector2_4.X) || float.IsNaN(vector2_4.Y))
vector2_4 = -Vector2.UnitY;
vector2_4 *= num5;
item.velocity = vector2_4;
float rotationOffset = 8;
Vector2 projectilePos = player.Center;
Vector2 spinningpoint = Vector2.Normalize(item.velocity) * rotationOffset;
for (int i = 0; i < 2; ++i)
{
spinningpoint = Utils.RotatedBy(spinningpoint, Main.rand.NextDouble() * 0.25F, new Vector2());
if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y))
spinningpoint = -Vector2.UnitY;
float angle = (float)Math.Atan(speedY / speedX);
Vector2 vector2 = new Vector2(projectilePos.X + 30 * (float)Math.Cos(angle), projectilePos.Y + 30 * (float)Math.Sin(angle));
float mouseX = Main.mouseX + Main.screenPosition.X;
if (mouseX < projectilePos.X)
{
vector2 = new Vector2(projectilePos.X - 30 * (float)Math.Cos(angle), projectilePos.Y - 30 * (float)Math.Sin(angle));
}
Projectile.NewProjectile(vector2.X, vector2.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockBack, Main.myPlayer);
}
return false;
}
示例2: Shoot
public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Vector2 relativeCenter = player.RotatedRelativePoint(player.MountedCenter, true);
float num5 = player.inventory[player.selectedItem].shootSpeed * item.scale;
Vector2 vector2_3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - relativeCenter;
if ((double)player.gravDir == -1.0)
vector2_3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - relativeCenter.Y;
Vector2 vector2_4 = Vector2.Normalize(vector2_3);
if (float.IsNaN(vector2_4.X) || float.IsNaN(vector2_4.Y))
vector2_4 = -Vector2.UnitY;
vector2_4 *= num5;
item.velocity = vector2_4;
float rotationOffset = 8;
int positionOffset = 2;
Vector2 projectilePos = player.Center + new Vector2(0, Main.rand.Next(-positionOffset, positionOffset + 1));
Vector2 spinningpoint = Vector2.Normalize(item.velocity) * rotationOffset;
spinningpoint = Utils.RotatedBy(spinningpoint, Main.rand.NextDouble() * 0.196349546313286 - 0.0981747731566429, new Vector2());
if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y))
spinningpoint = -Vector2.UnitY;
float angle = (float)Math.Atan(speedY / speedX);
Vector2 vector2 = new Vector2(projectilePos.X + 80F * (float)Math.Cos(angle), projectilePos.Y + 80F * (float)Math.Sin(angle));
float mouseX = Main.mouseX + Main.screenPosition.X;
if (mouseX < projectilePos.X)
{
vector2 = new Vector2(projectilePos.X - 80F * (float)Math.Cos(angle), projectilePos.Y - 80F * (float)Math.Sin(angle));
}
position = vector2;
speedX = spinningpoint.X * 3; // * 3 for faster bullet speed.
speedY = spinningpoint.Y * 3; // * 3 for faster bullet speed.
return true; // Spawn the bullet with the changed position and rotation.
}
示例3: Shoot
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
Vector2 relativeCenter = player.RotatedRelativePoint(player.MountedCenter, true);
float num5 = player.inventory[player.selectedItem].shootSpeed * item.scale;
Vector2 vector2_3 = Main.screenPosition + new Vector2((float)Main.mouseX, (float)Main.mouseY) - relativeCenter;
if ((double)player.gravDir == -1.0)
vector2_3.Y = (float)(Main.screenHeight - Main.mouseY) + Main.screenPosition.Y - relativeCenter.Y;
Vector2 vector2_4 = Vector2.Normalize(vector2_3);
if (float.IsNaN(vector2_4.X) || float.IsNaN(vector2_4.Y))
vector2_4 = -Vector2.UnitY;
vector2_4 *= num5;
item.velocity = vector2_4;
float rotationOffset = 8;
Vector2 spinningpoint = Vector2.Normalize(item.velocity) * rotationOffset;
spinningpoint = Utils.RotatedBy(spinningpoint, Main.rand.NextDouble() * 0.196349546313286 - 0.0981747731566429, new Vector2());
if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y))
spinningpoint = -Vector2.UnitY;
Projectile.NewProjectile(position.X, position.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockBack, item.owner);
spinningpoint = Vector2.Normalize(item.velocity) * rotationOffset;
spinningpoint = Utils.RotatedBy(spinningpoint, Main.rand.NextDouble() * 0.196349546313286 - 0.0981747731566429, new Vector2());
if (float.IsNaN(spinningpoint.X) || float.IsNaN(spinningpoint.Y))
spinningpoint = -Vector2.UnitY;
Projectile.NewProjectile(position.X, position.Y, spinningpoint.X, spinningpoint.Y, type, damage, knockBack, item.owner);
return false;//return base.Shoot(player, ref position, ref speedX, ref speedY, ref type, ref damage, ref knockBack);
}
示例4: HoldItem
public override void HoldItem(Player player)
{
if (Main.rand.Next(player.itemAnimation > 0 ? 40 : 80) == 0)
{
}
Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true);
Lighting.AddLight(position, 1f, 1f, 1f);
}
示例5: HoldItem
public override void HoldItem(Player player)
{
if (Main.rand.Next(player.itemAnimation > 0 ? 40 : 80) == 0)
{
Dust.NewDust(new Vector2(player.itemLocation.X + 16f * player.direction, player.itemLocation.Y - 14f * player.gravDir), 4, 4, mod.DustType("Sparkle"));
}
Vector2 position = player.RotatedRelativePoint(new Vector2(player.itemLocation.X + 12f * player.direction + player.velocity.X, player.itemLocation.Y - 14f + player.velocity.Y), true);
Lighting.AddLight(position, 1f, 1f, 1f);
}