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


C# Terraria.Player類代碼示例

本文整理匯總了C#中Terraria.Player的典型用法代碼示例。如果您正苦於以下問題:C# Player類的具體用法?C# Player怎麽用?C# Player使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Player類屬於Terraria命名空間,在下文中一共展示了Player類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Shoot

 public override bool Shoot(Player player, ref Microsoft.Xna.Framework.Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
 {
     Vector2 direction = new Vector2(speedX, speedY);
     direction.Normalize();
     position += direction * item.width;
     return true;
 }
開發者ID:Eldrazi,項目名稱:Pletharia,代碼行數:7,代碼來源:SuperSapphireStaff.cs

示例2: GetLightPosition

		private Vector2 GetLightPosition(Player player)
		{
			Vector2 position = Main.screenPosition;
			position.X += Main.mouseX;
			position.Y += player.gravDir == 1 ? Main.mouseY : Main.screenHeight - Main.mouseY;
			return position;
		}
開發者ID:DrakoGlyph,項目名稱:tModLoader,代碼行數:7,代碼來源:SparklingSphere.cs

示例3: DamagePVP

        /// <summary>
        /// When a <see cref="Player" /> in PvP is damaged by the <see cref="Projectile" />.
        /// </summary>
        /// <param name="p">The <see cref="Player" /> that got damaged.</param>
        /// <param name="dir">In which direction the <see cref="Player"/> got hit.</param>
        /// <param name="dmg">The damage dealt to the <see cref="Player" />.</param>
        /// <param name="crit">Wether it was a critical hit or not.</param>
        /// <param name="cMult">The damage multiplier of a critical hit.</param>
        public override void DamagePVP(Player p, int dir, ref int dmg, ref bool crit, ref float cMult)
        {
            base.DamagePVP(p, dir, ref dmg, ref crit, ref cMult);

            if (Main.rand.Next(3) == 0)
                p.AddBuff(20, 300);
        }
開發者ID:RainbowDashGaming,項目名稱:Terraria-Avalon-MODIFIED,代碼行數:15,代碼來源:Sporalash+Ball.cs

示例4: PostLoad

        public static void PostLoad(Player p)
        {
            magicFindBonus = 0f; //Reset bonus

            oldHealth = p.statLifeMax;
            oldMana = p.statManaMax;
        }
開發者ID:ThentyZ,項目名稱:tConfig-Mods,代碼行數:7,代碼來源:Player.cs

示例5: MeleeEffects

 public override void MeleeEffects(Player player, Rectangle hitbox)
 {
     if (Main.rand.Next(3) == 0)
     {
     int dust = Dust.NewDust(new Vector2(hitbox.X, hitbox.Y), hitbox.Width, hitbox.Height, mod.DustType("CCSparkle"));
     }
 }
開發者ID:MountainDrew8,項目名稱:CalamityMod,代碼行數:7,代碼來源:CatastropheClaymore.cs

示例6: ArmorSetBonus

        /// <summary>
        /// 
        /// </summary>
        /// <param name="p"></param>
        public override void ArmorSetBonus(Player p)
        {
            Main.dust[Dust.NewDust(p.position, p.width, p.height, 27, 0, 0, 200, Color.Purple, 1.0f)].noGravity = true;

            p.setBonus = "The Dark Matter has spread";
            p.invis = true;
        }
開發者ID:RainbowDashGaming,項目名稱:Terraria-Avalon-MODIFIED,代碼行數:11,代碼來源:Dark+Matter+Chest.cs

示例7: TSPlayer

 protected TSPlayer(String playerName)
 {
     TilesDestroyed = new Dictionary<Vector2, Tile>();
     Index = -1;
     FakePlayer = new Player { name = playerName, whoAmi = -1 };
     Group = new Group("null");
 }
開發者ID:grimfandango,項目名稱:TShock,代碼行數:7,代碼來源:TSPlayer.cs

示例8: UpdateVanitySet

		public virtual void UpdateVanitySet(Player player)
		{
			if (item != null)
			{
				item.UpdateVanitySet(player);
			}
		}
開發者ID:DrakoGlyph,項目名稱:tModLoader,代碼行數:7,代碼來源:EquipTexture.cs

示例9: ArmorSetShadows

		public virtual void ArmorSetShadows(Player player, ref bool longTrail, ref bool smallPulse, ref bool largePulse, ref bool shortTrail)
		{
			if (item != null)
			{
				item.ArmorSetShadows(player, ref longTrail, ref smallPulse, ref largePulse, ref shortTrail);
			}
		}
開發者ID:DrakoGlyph,項目名稱:tModLoader,代碼行數:7,代碼來源:EquipTexture.cs

示例10: OnHitPlayer

 public override void OnHitPlayer(Player player, int damage, bool crit)
 {
     if(Main.expertMode || Main.rand.Next(2) == 0)
     {
     player.AddBuff(BuffID.OnFire, 600, true);
     }
 }
開發者ID:digitalseraphim,項目名稱:tModLoader,代碼行數:7,代碼來源:AbominationRun.cs

示例11: UpdateVanity

		public virtual void UpdateVanity(Player player, EquipType type)
		{
			if (item != null)
			{
				item.UpdateVanity(player, type);
			}
		}
開發者ID:DrakoGlyph,項目名稱:tModLoader,代碼行數:7,代碼來源:EquipTexture.cs

示例12: UpdateAccessory

        public override void UpdateAccessory(Player player, bool hideVisual)
        {
            player.accRunSpeed = 6.75f;
            player.rocketBoots = 3;
            player.moveSpeed += 0.08f;
            player.iceSkate = true;

            if ((player.mount == null || player.mount.Type == 0 || !player.mount.Active) && !player.wet)
            {
                int minX = (int)(player.position.X / 16) - 1;
                int maxX = (int)(player.position.X / 16) + 3;
                int y = (int)(player.position.Y / 16) + 3;
                for (int x = minX; x < maxX; ++x)
                {
                    Tile tile = Main.tile[x, y];
                    if (tile.liquidType() == Tile.Liquid_Water && tile.liquid > 25 && !tile.active())
                    {
                        tile.active(true);
                        tile.type = TileID.BreakableIce;
                        tile.inActive(false);

                        Main.PlaySound(19, (int)player.position.X, (int)player.position.Y, 1);
                        Main.tile[x, y].liquid = 0;

                        WorldGen.SquareTileFrame(x, y, true);
                    }
                }
            }
        }
開發者ID:Eldrazi,項目名稱:Gyrolite,代碼行數:29,代碼來源:FreezingBoots.cs

示例13: ReadCustomData

 internal static void ReadCustomData(Player player, BinaryReader reader)
 {
     int count = reader.ReadUInt16();
     for (int k = 0; k < count; k++)
     {
         string modName = reader.ReadString();
         string name = reader.ReadString();
         byte[] data = reader.ReadBytes(reader.ReadUInt16());
         Mod mod = ModLoader.GetMod(modName);
         ModPlayer modPlayer = mod == null ? null : player.GetModPlayer(mod, name);
         if (modPlayer != null)
         {
             using (MemoryStream stream = new MemoryStream(data))
             {
                 using (BinaryReader customReader = new BinaryReader(stream))
                 {
                     modPlayer.LoadCustomData(customReader);
                 }
             }
             if (modName == "ModLoader" && name == "MysteryPlayer")
             {
                 ((MysteryPlayer)modPlayer).RestoreData(player);
             }
         }
         else
         {
             ModPlayer mystery = player.GetModPlayer(ModLoader.GetMod("ModLoader"), "MysteryPlayer");
             ((MysteryPlayer)mystery).AddData(modName, name, data);
         }
     }
 }
開發者ID:trekko727,項目名稱:tModLoader,代碼行數:31,代碼來源:PlayerIO.cs

示例14: OnHitNPC

 public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
 {
     if(!target.boss)
     {
     target.velocity.Y -= 5;
     }
 }
開發者ID:ColinAV516,項目名稱:EnergyMod,代碼行數:7,代碼來源:SoaringBat.cs

示例15: UpdateFrame

        public override bool UpdateFrame(Player player, int state, Vector2 velocity)
        {
            cool++;
            Vector2 position = Main.screenPosition;
            position.X += Main.mouseX;
            position.Y += Main.mouseY;
            Vector2 vector = Vector2.Subtract(position,player.position);
            if (velocity.Length() > 2f)
            {
                player.gravity = 0;
            }
            else
            {
                player.gravity = Player.defaultGravity;
            }
            if(cool > 60)
            {
                Main.NewText("X: "+vector.X +"  y: "+vector.Y);

            }

            player.position.Y += vector.Y > 5f ? 2.5f : vector.Y / 2;
            player.position.X += vector.X > 5f * player.direction ? 2.5f * player.direction : vector.X / 2;
            //vector = Vector2.Normalize(vector);
            //if (cool > 60)
            //{
            //    Main.NewText("X: " + vector.X + "  y: " + vector.Y);
            //    cool = 0;
            //}
            //player.position.Y += vector.Y * 2f;
            //player.position.X += vector.X;

            return true;
        }
開發者ID:itamargreen,項目名稱:Terraria1,代碼行數:34,代碼來源:Car.cs


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