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


C# Player.GetModPlayer方法代碼示例

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


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

示例1: 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

示例2: UpdateAccessory

 public override void UpdateAccessory(Player player, bool hideVisual)
 {
     GyrolitePlayer gp = (GyrolitePlayer)player.GetModPlayer(mod, "GyrolitePlayer");
     gp.ringType = 1;
     gp.ringEffects[0] = item.shoot;
     gp.ringEffects[1] = BuffID.CursedInferno;
 }
開發者ID:Eldrazi,項目名稱:Gyrolite,代碼行數:7,代碼來源:CursedFireRing.cs

示例3: Update

 public override void Update(Player player, ref int buffIndex)
 {
     player.GetModPlayer<ExamplePlayer>(mod).exampleLightPet = true;
     player.buffTime[buffIndex] = 18000;
     bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("ExampleLightPet")] <= 0;
     if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
     {
         Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("ExampleLightPet"), 0, 0f, player.whoAmI, 0f, 0f);
     }
     if ((player.controlDown && player.releaseDown))
     {
         if (player.doubleTapCardinalTimer[0] > 0 && player.doubleTapCardinalTimer[0] != 15)
         {
             for (int j = 0; j < 1000; j++)
             {
                 if (Main.projectile[j].active && Main.projectile[j].type == mod.ProjectileType("ExampleLightPet") && Main.projectile[j].owner == player.whoAmI)
                 {
                     Projectile lightpet = Main.projectile[j];
                     Vector2 vectorToMouse = Main.MouseWorld - lightpet.Center;
                     lightpet.velocity += 5f * Vector2.Normalize(vectorToMouse);
                 }
             }
         }
     }
 }
開發者ID:bluemagic123,項目名稱:tModLoader,代碼行數:25,代碼來源:ExampleLightPet.cs

示例4: UpdateArmorSet

        public override void UpdateArmorSet(Player player)
        {
            GyrolitePlayer p = player.GetModPlayer<GyrolitePlayer>(mod);
            p.frostbiteMax += 900;

            player.magicDamage += 0.08F;
            player.meleeDamage += 0.08F;
            player.rangedDamage += 0.08F;
            player.minionDamage += 0.08F;
            player.thrownDamage += 0.08F;
        }
開發者ID:Eldrazi,項目名稱:Gyrolite,代碼行數:11,代碼來源:GlacialHelmet.cs

示例5: UseItem

        public override bool UseItem(Player player)
        {
            GyrolitePlayer gp = player.GetModPlayer<GyrolitePlayer>(mod);
            player.statLifeMax += 50;
            gp.lunarHeartStack++;

            return true;
        }
開發者ID:Eldrazi,項目名稱:Gyrolite,代碼行數:8,代碼來源:LunarHeart.cs

示例6: EditSpawnRate

 public override void EditSpawnRate(Player player, ref int spawnRate, ref int maxSpawns)
 {
     if (player.GetModPlayer<ExamplePlayer>(mod).ZoneExample)
     {
         spawnRate = (int)(spawnRate * 5f);
         maxSpawns = (int)(maxSpawns * 5f);
     }
 }
開發者ID:bluemagic123,項目名稱:tModLoader,代碼行數:8,代碼來源:ExampleGlobalNPC.cs

示例7: ModifyHitPlayer

 public override void ModifyHitPlayer(Player target, ref int damage, ref bool crit)
 {
     if (target.hurtCooldowns[1] <= 0)
     {
         ExamplePlayer modPlayer = target.GetModPlayer<ExamplePlayer>(mod);
         modPlayer.constantDamage = projectile.damage;
         modPlayer.percentDamage = Main.expertMode ? 0.6f : 0.5f;
     }
 }
開發者ID:bluemagic123,項目名稱:tModLoader,代碼行數:9,代碼來源:PurityBeam.cs

示例8: CanUseItem

 public override bool CanUseItem(Player player)
 {
     GyrolitePlayer gp = player.GetModPlayer<GyrolitePlayer>(mod);
     if (gp.lunarHeartStack < 2)
     {
         return true;
     }
     return false;
 }
開發者ID:Eldrazi,項目名稱:Gyrolite,代碼行數:9,代碼來源:LunarHeart.cs

示例9: Update

		public override void Update(Player player, ref int buffIndex)
		{
			player.buffTime[buffIndex] = 18000;
            player.GetModPlayer<ExamplePlayer>(mod).examplePet = true;
			bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("ExamplePet")] <= 0;
			if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
			{
				Projectile.NewProjectile(player.position.X + (float)(player.width / 2), player.position.Y + (float)(player.height / 2), 0f, 0f, mod.ProjectileType("ExamplePet"), 0, 0f, player.whoAmI, 0f, 0f);
			}
		}
開發者ID:bluemagic123,項目名稱:tModLoader,代碼行數:10,代碼來源:ExamplePet.cs

示例10: Update

 public override void Update(Player player, ref int buffIndex)
 {
     player.buffTime[buffIndex] = 18000;
     ((GyrolitePlayer)player.GetModPlayer(mod, "GyrolitePlayer")).dwarfFeederPet = true;
     bool petProjectileNotSpawned = player.ownedProjectileCounts[mod.ProjectileType("DwarfFeederHead")] <= 0;
     if (petProjectileNotSpawned && player.whoAmI == Main.myPlayer)
     {
         Projectile.NewProjectile(Main.MouseWorld.X, Main.MouseWorld.Y, 0f, 0f, mod.ProjectileType("DwarfFeederHead"), 0, 0f, player.whoAmI, 0f, 0f);
     }
 }
開發者ID:Eldrazi,項目名稱:Gyrolite,代碼行數:10,代碼來源:DwarfFeederBuff.cs

示例11: Update

 public override void Update(Player player, ref int buffIndex)
 {
     SPlayer sPlayer = player.GetModPlayer<SPlayer>(mod);
     if (player.ownedProjectileCounts[mod.ProjectileType("UnboundSoul")] > 0)
     {
         sPlayer.unboundSoulMinion = true;
     }
     if (!sPlayer.unboundSoulMinion)
     {
         player.DelBuff(buffIndex);
         buffIndex--;
         return;
     }
     player.buffTime[buffIndex] = 18000;
 }
開發者ID:ColinAV516,項目名稱:Spirit-Mod,代碼行數:15,代碼來源:UnboundSoulMinionBuff.cs

示例12: Update

 public override void Update(Player player, ref int buffIndex)
 {
     EnergyPlayer modPlayer = (EnergyPlayer)player.GetModPlayer(mod, "EnergyPlayer");
     if (player.ownedProjectileCounts[mod.ProjectileType("TreeMinion")] > 0)
     {
         modPlayer.treeMinion = true;
     }
     if (!modPlayer.treeMinion)
     {
         player.DelBuff(buffIndex);
         buffIndex--;
     }
     else
     {
         player.buffTime[buffIndex] = 18000;
     }
 }
開發者ID:ColinAV516,項目名稱:EnergyMod,代碼行數:17,代碼來源:TreeMinion.cs

示例13: Update

 public override void Update(Player player, ref int buffIndex)
 {
     GyrolitePlayer gp = (GyrolitePlayer)player.GetModPlayer(mod, "GyrolitePlayer");
     if (player.ownedProjectileCounts[mod.ProjectileType("VileGeyserMinion")] > 0)
     {
         gp.vileGeyserMinion = true;
     }
     if (!gp.vileGeyserMinion)
     {
         player.DelBuff(buffIndex);
         buffIndex--;
     }
     else
     {
         player.buffTime[buffIndex] = 18000;
     }
 }
開發者ID:Eldrazi,項目名稱:Gyrolite,代碼行數:17,代碼來源:VileGeyserMinionBuff.cs

示例14: Update

		public override void Update(Player player, ref int buffIndex)
		{
			ExamplePlayer modPlayer = player.GetModPlayer<ExamplePlayer>(mod);
			if (player.ownedProjectileCounts[mod.ProjectileType("PurityWisp")] > 0)
			{
				modPlayer.purityMinion = true;
			}
			if (!modPlayer.purityMinion)
			{
				player.DelBuff(buffIndex);
				buffIndex--;
			}
			else
			{
				player.buffTime[buffIndex] = 18000;
			}
		}
開發者ID:bluemagic123,項目名稱:tModLoader,代碼行數:17,代碼來源:PurityWisp.cs

示例15: UseItem

		public override bool UseItem(Item item, Player player)
		{
			if (item.healLife > 0)
			{
				if (player.GetModPlayer<ExamplePlayer>(mod).badHeal)
				{
					int heal = item.healLife;
					int damage = player.statLifeMax2 - player.statLife;
					if (heal > damage)
					{
						heal = damage;
					}
					if (heal > 0)
					{
						player.AddBuff(mod.BuffType("Undead2"), 2 * heal, false);
					}
				}
			}
			return base.UseItem(item, player);
		}
開發者ID:bluemagic123,項目名稱:tModLoader,代碼行數:20,代碼來源:Potion.cs


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