本文整理匯總了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);
}
}
}
示例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;
}
示例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);
}
}
}
}
}
示例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;
}
示例5: UseItem
public override bool UseItem(Player player)
{
GyrolitePlayer gp = player.GetModPlayer<GyrolitePlayer>(mod);
player.statLifeMax += 50;
gp.lunarHeartStack++;
return true;
}
示例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);
}
}
示例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;
}
}
示例8: CanUseItem
public override bool CanUseItem(Player player)
{
GyrolitePlayer gp = player.GetModPlayer<GyrolitePlayer>(mod);
if (gp.lunarHeartStack < 2)
{
return true;
}
return false;
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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);
}