當前位置: 首頁>>代碼示例>>C#>>正文


C# NPC.Transform方法代碼示例

本文整理匯總了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;
                    }
開發者ID:thegamingboffin,項目名稱:Ulterraria_Reborn_GitHub,代碼行數:67,代碼來源:UlterrariaNPCs.cs

示例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);
開發者ID:thegamingboffin,項目名稱:Ulterraria_Reborn_GitHub,代碼行數:67,代碼來源:UlterrariaNPCs.cs


注:本文中的Terraria.NPC.Transform方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。