本文整理汇总了C#中Terraria.Player.getRect方法的典型用法代码示例。如果您正苦于以下问题:C# Player.getRect方法的具体用法?C# Player.getRect怎么用?C# Player.getRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terraria.Player
的用法示例。
在下文中一共展示了Player.getRect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateEffects
public override void UpdateEffects(Player player)
{
if (Math.Abs(player.velocity.X) > 4f)
{
Rectangle rect = player.getRect();
int dust = ModDust.NewDust(new Vector2(rect.X, rect.Y), rect.Width, rect.Height, mod, "Smoke");
}
}
示例2: UpdateEffects
public override void UpdateEffects(Player player)
{
if (Math.Abs(player.velocity.X) > player.mount.DashSpeed - player.mount.RunSpeed / 2f)
{
player.noKnockback = true;
Rectangle rect = player.getRect();
//Tweak hitbox to be the Basilisks head
rect.Width = 2;
rect.Height = 2;
if (player.direction == 1)
{
rect.Offset(player.width - 1, 0);
}
rect.Offset(0, player.height - 19);
rect.Inflate(28, 16);
for (int n = 0; n < Main.maxNPCs; n++)
{
NPC npc = Main.npc[n];
if (npc.active && !npc.dontTakeDamage && !npc.friendly && npc.immune[player.whoAmI] == 0)
{
Rectangle rect2 = npc.getRect();
if (rect.Intersects(rect2) && (npc.noTileCollide || Collision.CanHit(player.position, player.width, player.height, npc.position, npc.width, npc.height)))
{
float damage = BasiliskMount.damage * player.minionDamage;
float knockback = BasiliskMount.knockback * player.minionKB;
int direction = player.direction;
if (player.velocity.X < 0f)
{
direction = -1;
}
if (player.velocity.X > 0f)
{
direction = 1;
}
if (player.whoAmI == Main.myPlayer)
{
player.ApplyDamageToNPC(npc, (int)damage, knockback, direction, false);
}
npc.immune[player.whoAmI] = 30;
player.immune = true;
player.immuneTime = 6;
return;
}
}
}
}
}