当前位置: 首页>>代码示例>>C#>>正文


C# Projectile.SetDefaults方法代码示例

本文整理汇总了C#中Terraria.Projectile.SetDefaults方法的典型用法代码示例。如果您正苦于以下问题:C# Projectile.SetDefaults方法的具体用法?C# Projectile.SetDefaults怎么用?C# Projectile.SetDefaults使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Terraria.Projectile的用法示例。


在下文中一共展示了Projectile.SetDefaults方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FillVanilla

        /// <summary>
        /// Adds all the original vanilla projectiles.
        /// </summary>
        internal static void FillVanilla()
        {
            for (int i = -65; i < ProjectileID.Count; i++)
            {
                if (i == 0)
                    continue;

                Projectile p = new Projectile();
                p.SetDefaults(i);

                ProjectileDef def = new ProjectileDef();

                def.InternalName = p.name;
                def.Type = p.type;

                CopyProjectileToDef(def, p);

                DefFromType.Add(i, def);
                VanillaDefFromName.Add(p.name, def);
            }
        }
开发者ID:chatrat12,项目名称:Prism,代码行数:24,代码来源:ProjectileDefHandler.cs

示例2: Item_PP

        public Item_PP(Mod game, Rectangle rect)
            : base(rect, "P.P.")
        {
            Game = game;
            Children.Add(new XG_Label(new Rectangle(10, 0, 200, 20), "projectile properties"));

            // string text = "";
            //text = "Shoot";
            //Shoot = new XG_PlusMinus(new Rectangle(10, 10, 100, 60), text, this.Shoot_Clicked);
            //Children.Add(Shoot);

            Tree = new XGTree(new Rectangle(250, 0, 170, 115), TreeItemClicked);
            Children.Add(Tree);

            XGTreeItem Shoot = new XGTreeItem("Shoot", Main.inventoryBackTexture);
            Tree.Items.Add(Shoot);
            for (int n = 0; n < Main.maxProjectileTypes; n++) // add section items
            {
                if (n != 0)
                {
                    Projectile projectile = new Projectile();
                    projectile.SetDefaults(n);
                    XGTreeItem Shoot_Section_items = new XGTreeItem(projectile.name, Main.projectileTexture[projectile.type]);
                    Tree.Items.Add(Shoot_Section_items);
                }
            }

            string text = "";
            text = "ammo";
            ammo = new XG_PlusMinus(new Rectangle(10, 60, 100, 60), text, this.ammo_Clicked, 1f, false, false, 0, 50, 0, "F0");
            Children.Add(ammo);

            text = "useammo";
            useAmmo = new XG_PlusMinus(new Rectangle(10, 10, 100, 60), text, this.useAmmo_Clicked, 1f, false, false, 0, 50, 0, "F0");
            Children.Add(useAmmo);

            text = "shootspeed";
            shootSpeed = new XG_PlusMinus(new Rectangle(100, 60, 100, 60), text, this.shootSpeed_Clicked, 0.1f, true, false, 0, 100f, 0, "F1");
            Children.Add(shootSpeed);

            text = "knockBack";
            knockBack = new XG_PlusMinus(new Rectangle(100, 10, 100, 60), text, this.knockBack_Clicked, 1f, false, false, 0, 500, 0, "F0");
            Children.Add(knockBack);

            text = "channel";
            channel = new XG_ButtonLabelBool(new Rectangle(200, 10, 100, 60), text, this.channel_Clicked);
            Children.Add(channel);
        }
开发者ID:dantedom,项目名称:editormod,代码行数:48,代码来源:Windows.cs

示例3: Initialize


//.........这里部分代码省略.........
     {
         Main.item[w] = new Item();
     }
     for (int x = 0; x < 201; x++)
     {
         Main.npc[x] = new NPC();
         Main.npc[x].whoAmI = x;
     }
     for (int y = 0; y < 256; y++)
     {
         Main.player[y] = new Player();
     }
     for (int a = 0; a < 1001; a++)
     {
         Main.projectile[a] = new Projectile();
     }
     for (int d = 0; d < 200; d++)
     {
         Main.cloud[d] = new Cloud();
     }
     for (int e = 0; e < 100; e++)
     {
         Main.combatText[e] = new CombatText();
     }
     for (int f = 0; f < 20; f++)
     {
         Main.itemText[f] = new ItemText();
     }
     int num = 0;
     Label3:
     while (num < Main.maxItemTypes)
     {
         item = new Item();
         item.SetDefaults(num, false);
         Main.itemName[num] = item.name;
         if (item.headSlot > 0)
         {
             Item.headType[item.headSlot] = item.type;
         }
         if (item.bodySlot > 0)
         {
             Item.bodyType[item.bodySlot] = item.type;
         }
         if (item.legSlot > 0)
         {
             Item.legType[item.legSlot] = item.type;
         }
         int num1 = item.type;
         if (num1 <= 1827)
         {
             if (num1 > 788)
             {
                 if (num1 > 1326)
                 {
                     switch (num1)
                     {
                         case 1444:
                         case 1445:
                         case 1446:
                             {
                                 break;
                             }
                         default:
                             {
                                 if (num1 == 1801)
                                 {
开发者ID:Celant,项目名称:TerrariaAPI-Server,代码行数:67,代码来源:Main.cs

示例4: CheckProjectilePermission

        public static bool CheckProjectilePermission(TSPlayer player, int index, int type)
        {
            if (type == 43)
            {
                return true;
            }

            if (type == 17 && !player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned("Dirt Rod", player)) //Dirt Rod Projectile
            {
                return true;
            }

            if ((type == 42 || type == 65 || type == 68) && !player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned("Sandgun", player)) //Sandgun Projectiles
            {
                return true;
            }

            Projectile proj = new Projectile();
            proj.SetDefaults(type);

            if (!player.Group.HasPermission(Permissions.usebanneditem) && TShock.Itembans.ItemIsBanned(proj.name, player))
            {
                return true;
            }

            if (proj.hostile)
            {
                return true;
            }

            return false;
        }
开发者ID:Icehawk78,项目名称:TShock,代码行数:32,代码来源:TShock.cs

示例5: GetStaticProjectiles

 public Projectile[] GetStaticProjectiles()
 {
     List<Projectile> projectiles = new List<Projectile>();
     for (int i = 100; i > -1; i--)
     {
         Projectile projectile = new Projectile();
         projectile.SetDefaults(i);
         try
         {
             if (projectile.name.ToLower() != "")
             {
                 projectiles.Add(projectile);
             }
         }
         catch
         {
             continue;
         }
     }
     return projectiles.ToArray();
 }
开发者ID:kamilion,项目名称:WraithModRevival,代码行数:21,代码来源:Core.cs

示例6: Initialize


//.........这里部分代码省略.........
				Main.npc[num8].whoAmI = num8;
			}
			for (int num9 = 0; num9 < 256; num9++)
			{
				Main.player[num9] = new Player();
			}
			for (int num10 = 0; num10 < 1001; num10++)
			{
				Main.projectile[num10] = new Projectile();
			}
			for (int num11 = 0; num11 < 501; num11++)
			{
				Main.gore[num11] = new Gore();
			}
			for (int num12 = 0; num12 < Main.maxRain + 1; num12++)
			{
				Main.rain[num12] = new Rain();
			}
			for (int num13 = 0; num13 < 200; num13++)
			{
				Main.cloud[num13] = new Cloud();
			}
			for (int num14 = 0; num14 < 100; num14++)
			{
				Main.combatText[num14] = new CombatText();
			}
			for (int num15 = 0; num15 < 20; num15++)
			{
				Main.itemText[num15] = new ItemText();
			}
			for (int num16 = 0; num16 < 2749; num16++)
			{
				Item item = new Item();
				item.SetDefaults(num16, false);
				Main.itemName[num16] = item.name;
				if (item.headSlot > 0)
				{
					Item.headType[item.headSlot] = item.type;
				}
				if (item.bodySlot > 0)
				{
					Item.bodyType[item.bodySlot] = item.type;
				}
				if (item.legSlot > 0)
				{
					Item.legType[item.legSlot] = item.type;
				}
			}
			NPC nPC = new NPC();
			for (int num17 = -65; num17 < 378; num17++)
			{
				if (num17 != 0)
				{
					nPC.netDefaults(num17);
					if (nPC.lifeMax > 32767)
					{
						Main.npcLifeBytes[num17] = 4;
					}
					else
					{
						if (nPC.lifeMax > 127)
						{
							Main.npcLifeBytes[num17] = 2;
						}
						else
						{
开发者ID:NoviaDroid,项目名称:Terraria,代码行数:67,代码来源:Main.cs

示例7: Initialize


//.........这里部分代码省略.........
         Main.npc[num3].whoAmI = num3;
     }
     for (int num4 = 0; num4 < 256; num4++)
     {
         Main.player[num4] = new Player();
     }
     for (int num5 = 0; num5 < 1001; num5++)
     {
         Main.projectile[num5] = new Projectile();
     }
     for (int num6 = 0; num6 < 501; num6++)
     {
         Main.gore[num6] = new Gore();
     }
     for (int num7 = 0; num7 < Main.maxRain + 1; num7++)
     {
         Main.rain[num7] = new Rain();
     }
     for (int num8 = 0; num8 < 200; num8++)
     {
         Main.cloud[num8] = new Cloud();
     }
     for (int num9 = 0; num9 < 100; num9++)
     {
         Main.combatText[num9] = new CombatText();
     }
     for (int num10 = 0; num10 < 20; num10++)
     {
         Main.itemText[num10] = new ItemText();
     }
     for (int num11 = 0; num11 < 1725; num11++)
     {
         Item item = new Item();
         item.SetDefaults(num11, false);
         Main.itemName[num11] = item.name;
         if (item.headSlot > 0)
         {
             Item.headType[item.headSlot] = item.type;
         }
         if (item.bodySlot > 0)
         {
             Item.bodyType[item.bodySlot] = item.type;
         }
         if (item.legSlot > 0)
         {
             Item.legType[item.legSlot] = item.type;
         }
     }
     for (int num12 = 0; num12 < Recipe.maxRecipes; num12++)
     {
         Main.recipe[num12] = new Recipe();
         Main.availableRecipeY[num12] = (float)(65 * num12);
     }
     Recipe.SetupRecipes();
     for (int num13 = 0; num13 < Main.numChatLines; num13++)
     {
         Main.chatLine[num13] = new ChatLine();
     }
     for (int num14 = 0; num14 < Liquid.resLiquid; num14++)
     {
         Main.liquid[num14] = new Liquid();
     }
     for (int num15 = 0; num15 < 10000; num15++)
     {
         Main.liquidBuffer[num15] = new LiquidBuffer();
     }
开发者ID:brianmcmichael,项目名称:Terraria-Source-Code,代码行数:67,代码来源:Main.cs

示例8: FindProjectiles

        /// <summary>
        /// Gets a list of matching projectiles.
        /// </summary>
        /// <param name="name">The name to search for.</param>
        /// <returns>The result.</returns>
        public static List<Projectile> FindProjectiles(string name)
        {
            int id;
            if (int.TryParse(name, out id) && id >= 0 && id < Main.maxProjectileTypes)
            {
                var projectile = new Projectile();
                projectile.SetDefaults(id);
                return new List<Projectile> { projectile };
            }

            var projectiles = new List<Projectile>();
            for (int i = 0; i < Main.maxProjectileTypes; i++)
            {
                if (String.Equals(projNames[i], name, StringComparison.CurrentCultureIgnoreCase))
                {
                    var projectile = new Projectile();
                    projectile.SetDefaults(i);
                    return new List<Projectile> { projectile };
                }
                else if (projNames[i].ToLower().StartsWith(name.ToLower()))
                {
                    var projectile = new Projectile();
                    projectile.SetDefaults(i);
                    projectiles.Add(projectile);
                }
            }
            return projectiles;
        }
开发者ID:UB1AFU,项目名称:Raptor,代码行数:33,代码来源:Utils.cs

示例9: Initialize

        internal static void Initialize()
        {
            var item = new Item();
            for (int i = -48; i < Main.maxItemTypes; i++)
            {
                item.netDefaults(i);
                itemNames.Add(i, item.name);
            }

            var proj = new Projectile();
            for (int i = 0; i < Main.maxProjectileTypes; i++)
            {
                proj.SetDefaults(i);
                projNames[i] = proj.name;
            }
        }
开发者ID:UB1AFU,项目名称:Raptor,代码行数:16,代码来源:Utils.cs

示例10: FormatProjectiles

 public string FormatProjectiles()
 {
     var proj = new Projectile();
     var projectiles = new List<Projectile>();
     for (var i = 1; i < Main.maxProjectileTypes; i++)
     {
         proj.SetDefaults(i);
         projectiles.Add(proj);
     }
     var orderedProjectiles = from x in projectiles orderby x.type select x;
     return JsonConvert.SerializeObject(orderedProjectiles, Formatting.Indented);
 }
开发者ID:WhiteXZ,项目名称:Documentation,代码行数:12,代码来源:JSONFormatter.cs

示例11: FormatProjectilesSimple

        public string FormatProjectilesSimple()
        {
            var projIs = new List<ProjectileInfo>();

            var proj = new Projectile();
            for (var i = 1; i < Main.maxProjectileTypes; i++)
            {
                proj.SetDefaults(i);
                var projInfo = new ProjectileInfo(proj.name, proj.type, proj.aiStyle, proj.friendly, proj.penetrate,
                    proj.noDropItem, proj.minion, proj.numHits, proj.magic, proj.ranged, proj.melee, proj.damage);

                projIs.Add(projInfo);
            }
            var orderedProjectiles = from x in projIs orderby x.type select x;
            return JsonConvert.SerializeObject(orderedProjectiles, Formatting.Indented);
        }
开发者ID:WhiteXZ,项目名称:Documentation,代码行数:16,代码来源:JSONFormatter.cs

示例12: Initialize


//.........这里部分代码省略.........
     }
     for (int num2 = 0; num2 < 201; num2++)
     {
         Main.npc[num2] = new NPC();
         Main.npc[num2].whoAmI = num2;
     }
     for (int num3 = 0; num3 < 256; num3++)
     {
         Main.player[num3] = new Player();
     }
     for (int num4 = 0; num4 < 1001; num4++)
     {
         Main.projectile[num4] = new Projectile();
     }
     for (int num5 = 0; num5 < 201; num5++)
     {
         Main.gore[num5] = new Gore();
     }
     for (int num6 = 0; num6 < 100; num6++)
     {
         Main.cloud[num6] = new Cloud();
     }
     for (int num7 = 0; num7 < 100; num7++)
     {
         Main.combatText[num7] = new CombatText();
     }
     for (int num8 = 0; num8 < 20; num8++)
     {
         Main.itemText[num8] = new ItemText();
     }
     for (int num9 = 0; num9 < 604; num9++)
     {
         Item item = new Item();
         item.SetDefaults(num9, false);
         Main.itemName[num9] = item.name;
         if (item.headSlot > 0)
         {
             Item.headType[item.headSlot] = item.type;
         }
         if (item.bodySlot > 0)
         {
             Item.bodyType[item.bodySlot] = item.type;
         }
         if (item.legSlot > 0)
         {
             Item.legType[item.legSlot] = item.type;
         }
     }
     for (int num10 = 0; num10 < Recipe.maxRecipes; num10++)
     {
         Main.recipe[num10] = new Recipe();
         Main.availableRecipeY[num10] = (float)(65 * num10);
     }
     Recipe.SetupRecipes();
     for (int num11 = 0; num11 < Main.numChatLines; num11++)
     {
         Main.chatLine[num11] = new ChatLine();
     }
     for (int num12 = 0; num12 < Liquid.resLiquid; num12++)
     {
         Main.liquid[num12] = new Liquid();
     }
     for (int num13 = 0; num13 < 10000; num13++)
     {
         Main.liquidBuffer[num13] = new LiquidBuffer();
     }
开发者ID:Oraki51,项目名称:Spectre-Mod,代码行数:67,代码来源:Main.cs

示例13: FormatProjectiles

        public string FormatProjectiles()
        {
            var sb = new StringBuilder();
            sb.AppendLine("\"Name\",\"Type\",\"AI\",\"Friendly\",\"Penetrating\",\"NotItemDropping\",\"Minion\",\"NumberOfHits\",\"Magic\",\"Range\",\"Melee\",\"Damage\"");

            var projectiles = new List<Projectile>();

            for (int i = 0; i < Main.maxProjectileTypes; i++)
            {
                var proj = new Projectile();
                proj.SetDefaults(i);
                projectiles.Add(proj);
            }

            foreach (var proj in projectiles)
            {
                sb.AppendFormat("\"{0}\"\",{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\",\"{6}\",\"{7}\",\"{8}\",\"{9}\",\"{10}\",\"{11}\"\n",
                    proj.name, proj.type, proj.aiStyle, proj.friendly, proj.penetrate,
                    proj.noDropItem, proj.minion, proj.numHits, proj.magic, proj.ranged,
                    proj.melee, proj.damage);
            }
            return sb.ToString();
        }
开发者ID:WhiteXZ,项目名称:Documentation,代码行数:23,代码来源:CSVFormatter.cs

示例14: OnSetDefaults

        internal static void OnSetDefaults(Projectile p, int type)
        {
            ProjectileBHandler h = null;

            p.SetDefaults(0);

            if (DefFromType.ContainsKey(type))
            {
                var d = DefFromType[type];

                p.type = type;
                p.width = p.height = 16;

                CopyDefToProjectile(p, d);

                h = new ProjectileBHandler();
                if (d.CreateBehaviour != null)
                {
                    var b = d.CreateBehaviour();

                    if (b != null)
                        h.behaviours.Add(b);
                }

                p.BHandler = h;
            }

            //TODO: add global hooks here (and check for null)

            if (h != null)
            {
                h.Create();
                p.BHandler = h;

                foreach (var b in h.Behaviours)
                    b.Entity = p;

                h.OnInit();
            }
        }
开发者ID:chatrat12,项目名称:Prism,代码行数:40,代码来源:ProjectileDefHandler.cs

示例15: TreeItemClicked

        //Button click event handler
        void TreeItemClicked(XGTreeItem name)
        {
            for (int n = 0; n < Main.maxProjectileTypes; n++) // add section items
            {
                Projectile projectile = new Projectile();
                projectile.SetDefaults(n);
                if (projectile.name == name.Value.ToString())
                {

                    Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].shoot = n;
                    break;
                }
            }
        }
开发者ID:dantedom,项目名称:editormod,代码行数:15,代码来源:Windows.cs


注:本文中的Terraria.Projectile.SetDefaults方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。