本文整理匯總了C#中Terraria_Server.NPC.SetDefaults方法的典型用法代碼示例。如果您正苦於以下問題:C# NPC.SetDefaults方法的具體用法?C# NPC.SetDefaults怎麽用?C# NPC.SetDefaults使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Terraria_Server.NPC
的用法示例。
在下文中一共展示了NPC.SetDefaults方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: AIWorm
//.........這裏部分代碼省略.........
(npc.type >= NPCType.N87_WYVERN_HEAD && npc.type < NPCType.N92_WYVERN_TAIL) || npc.type == NPCType.N117_LEECH_HEAD || npc.type == NPCType.N118_LEECH_BODY) &&
(!Main.npcs[(int)npc.ai[0]].Active || Main.npcs[(int)npc.ai[0]].aiStyle != npc.aiStyle))
{
npc.life = 0;
npc.HitEffect(0, 10.0);
npc.Active = false;
}
if (npc.type == NPCType.N13_EATER_OF_WORLDS_HEAD || npc.type == NPCType.N14_EATER_OF_WORLDS_BODY || npc.type == NPCType.N15_EATER_OF_WORLDS_TAIL)
{
if (!Main.npcs[(int)npc.ai[1]].Active && !Main.npcs[(int)npc.ai[0]].Active)
{
npc.life = 0;
npc.HitEffect(0, 10.0);
npc.Active = false;
}
if (npc.type == NPCType.N13_EATER_OF_WORLDS_HEAD && !Main.npcs[(int)npc.ai[0]].Active)
{
npc.life = 0;
npc.HitEffect(0, 10.0);
npc.Active = false;
}
if (npc.type == NPCType.N15_EATER_OF_WORLDS_TAIL && !Main.npcs[(int)npc.ai[1]].Active)
{
npc.life = 0;
npc.HitEffect(0, 10.0);
npc.Active = false;
}
if (npc.type == NPCType.N14_EATER_OF_WORLDS_BODY && (!Main.npcs[(int)npc.ai[1]].Active || Main.npcs[(int)npc.ai[1]].aiStyle != npc.aiStyle))
{
npc.type = NPCType.N13_EATER_OF_WORLDS_HEAD;
int num100 = npc.whoAmI;
float num101 = (float)npc.life / (float)npc.lifeMax;
float num102 = npc.ai[0];
npc.SetDefaults((int)npc.type);
npc.life = (int)((float)npc.lifeMax * num101);
npc.ai[0] = num102;
npc.TargetClosest(true);
npc.netUpdate = true;
npc.whoAmI = num100;
}
if (npc.type == NPCType.N14_EATER_OF_WORLDS_BODY && (!Main.npcs[(int)npc.ai[0]].Active || Main.npcs[(int)npc.ai[0]].aiStyle != npc.aiStyle))
{
int num103 = npc.whoAmI;
float num104 = (float)npc.life / (float)npc.lifeMax;
float num105 = npc.ai[1];
npc.SetDefaults((int)npc.type);
npc.life = (int)((float)npc.lifeMax * num104);
npc.ai[1] = num105;
npc.TargetClosest(true);
npc.netUpdate = true;
npc.whoAmI = num103;
}
if (npc.life == 0)
{
bool EoWAlive = false;
for (int npcId = 0; npcId < MAX_NPCS; npcId++)
{
var fNpc = Main.npcs[npcId];
if (fNpc.Active)
{
EoWAlive = (
fNpc.type == NPCType.N13_EATER_OF_WORLDS_HEAD ||
fNpc.type == NPCType.N14_EATER_OF_WORLDS_BODY ||
fNpc.type == NPCType.N15_EATER_OF_WORLDS_TAIL);