本文整理汇总了C#中Terraria.NPC.Transform方法的典型用法代码示例。如果您正苦于以下问题:C# NPC.Transform方法的具体用法?C# NPC.Transform怎么用?C# NPC.Transform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Terraria.NPC
的用法示例。
在下文中一共展示了NPC.Transform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NPCAiStyles
//.........这里部分代码省略.........
}
}
}
}
npc.active = false;
return;
FoundTree:
npc.position.X = npc.ai[1] * 16f;
npc.position.Y = npc.ai[2] * 16f;
}
catch
{
npc.active = false;
}
}
if (Main.tile[(int)npc.ai[1], (int)npc.ai[2]] == null)
{
Main.tile[(int)npc.ai[1], (int)npc.ai[2]] = new Tile();
}
if (Main.tile[(int)npc.ai[1], (int)npc.ai[2] + 1] == null)
{
Main.tile[(int)npc.ai[1], (int)npc.ai[2] + 1] = new Tile();
}
if (Main.tile[(int)npc.ai[1], (int)npc.ai[2] - 1] == null)
{
Main.tile[(int)npc.ai[1], (int)npc.ai[2] - 1] = new Tile();
}
if (Main.tile[(int)npc.ai[1], (int)npc.ai[2]].type != 5)
{
npc.ai[3] = 10f;
}
if (npc.ai[3] == 10f)
{
npc.Transform(568);
npc.lifeMax = npc.life = 9999;
npc.velocity.Y = 0.06f;
}
else
{
npc.TargetClosest(false);
if (Collision.CanHit(npc.position, npc.width, npc.height, Main.player[npc.target].position, Main.player[npc.target].width, Main.player[npc.target].height))
{
if (Main.player[npc.target].Center.X <= (npc.ai[1] * 16f) + 8f)
{
npc.direction = -1;
}
else
{
npc.direction = 1;
}
}
else
{
if (Main.rand.Next(740) == 0)
{
npc.direction = -npc.direction;
}
}
if (npc.direction == -1)
{
npc.position.X = (npc.ai[1] * 16f) - 32;
}
else
{
npc.position.X = npc.ai[1] * 16f;
}
示例2: Gores
//.........这里部分代码省略.........
return;
}
else
{
for (int num9 = 0; num9 < 40; num9++)
{
Dust.NewDust(npc.position, npc.width, npc.height, 18, (float)hitDirection, -1f, 0, default(Color), 1f);
if (Main.rand.Next(3) == 0)
{
Dust dust2 = Main.dust[Dust.NewDust(npc.position, npc.width, npc.height, 18, 0f, 0f, 0, default(Color), 1f)];
dust2.noGravity = true;
dust2.scale = 1.5f;
dust2.fadeIn = 1f;
dust2.velocity *= 3f;
}
}
Gore.NewGore(new Vector2(npc.Center.X, npc.Center.Y), npc.velocity, 928, npc.scale);
Gore.NewGore(new Vector2(npc.Center.X, npc.Center.Y), npc.velocity, 929, npc.scale);
Gore.NewGore(new Vector2(npc.Center.X, npc.Center.Y), npc.velocity, 930, npc.scale);
}
}
else if (npc.type == 555 && npc.ai[1] == 0 && npc.life <= 0)
{
npc.ai[1] = 1;
npc.lifeMax = npc.life = 25000;
if (Main.expertMode)
{
npc.lifeMax = npc.life = 50000;
}
Gore.NewGore(new Vector2(npc.Center.X, npc.Center.Y), npc.velocity, 931, 1f);
}
else if (npc.type == 558 && npc.life <= 0)
{
npc.Transform(559);
npc.life = npc.lifeMax = 140;
}
else if (npc.type == 554)
{
if (npc.life > 0)
{
int num431 = 0;
while ((double)num431 < dmg / (double)npc.lifeMax * 100.0)
{
if (npc.dustID != -1)
Dust.NewDust(npc.position, npc.width, npc.height, npc.dustID, (float)hitDirection, -1f, npc.alpha, npc.color, npc.scale);
else
Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, npc.alpha, npc.color, npc.scale);
num431++;
}
return;
}
else
{
for (int num9 = 0; num9 < 40; num9++)
{
if (npc.dustID != -1)
Dust.NewDust(npc.position, npc.width, npc.height, npc.dustID, (float)hitDirection, -1f, npc.alpha, npc.color, npc.scale);
else
Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, npc.alpha, npc.color, npc.scale);
if (Main.rand.Next(3) == 0)
{
int index = 0;
if (npc.dustID != -1)
index = Dust.NewDust(npc.position, npc.width, npc.height, npc.dustID, (float)hitDirection, -1f, npc.alpha, npc.color, npc.scale);
else
index = Dust.NewDust(npc.position, npc.width, npc.height, 5, (float)hitDirection, -1f, npc.alpha, npc.color, npc.scale);