本文整理汇总了C#中Terraria.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于Terraria命名空间,在下文中一共展示了Player类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: UpdateAccessory
public override void UpdateAccessory(Player player)
{
player.buffImmune[BuffID.Darkness] = true;
player.buffImmune[BuffID.Blackout] = true;
Lighting.AddLight(player.position, 0.5F, 0, 0.5F); // Add a small, red light to the player.
}
开发者ID:Eldrazi,项目名称:Pletharia,代码行数:7,代码来源:ShadowRing.cs
示例17: OnHitNPC
public override void OnHitNPC(Player player, NPC target, int damage, float knockback, bool crit)
{
target.AddBuff(BuffID.OnFire, 10);
target.AddBuff(BuffID.Electrified, 3);
target.AddBuff(BuffID.Venom, 5);
target.AddBuff(BuffID.CursedInferno, 4);
}
开发者ID:MountainDrew8,项目名称:CalamityMod,代码行数:7,代码来源:CataclysmicTerrorBlade.cs
示例18: Shoot
public override bool Shoot(Player player, ref Vector2 position, ref float speedX, ref float speedY, ref int type, ref int damage, ref float knockBack)
{
for (int i = 0; i < 3; ++i)
{
position = new Vector2(player.position.X + (player.width * 0.5f) + (float)Main.rand.Next(201) * -player.direction + ((float)Main.mouseX + Main.screenPosition.X - player.position.X), player.MountedCenter.Y - 600f);
position.X = (position.X * 10f + player.Center.X) / 11f + (float)Main.rand.Next(-100, 101);
position.Y -= (float)(150 * i);
speedX = (float)Main.mouseX + Main.screenPosition.X - position.X;
speedY = (float)Main.mouseY + Main.screenPosition.Y - position.Y;
if (speedY < 0f)
{
speedY *= -1f;
}
if (speedY < 20f)
{
speedY = 20f;
}
float num80 = (float)Math.Sqrt((double)(speedX * speedX + speedY * speedY));
num80 = item.shootSpeed / num80;
speedX *= num80;
speedY *= num80;
speedX = speedX + Main.rand.Next(-40, 41) * 0.03f;
speedY = speedY + (float)Main.rand.Next(-40, 41) * 0.03f;
speedX *= (float)Main.rand.Next(75, 150) * 0.01f;
position.X += (float)Main.rand.Next(-50, 51);
Projectile.NewProjectile(position.X, position.Y, speedX, speedY, type, damage, knockBack, player.whoAmI, player.Center.Y, 0f);
}
return false;
}
开发者ID:Eldrazi,项目名称:Gyrolite,代码行数:30,代码来源:CursedFireRing.cs
示例19: UseStyle
public override void UseStyle(Player player)
{
if (player.whoAmI == Main.myPlayer && player.itemTime == 0)
{
player.AddBuff(item.buffType, 3600, true);
}
}
开发者ID:DrakoGlyph,项目名称:tModLoader,代码行数:7,代码来源:ExampleLightPet.cs
示例20: 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
注:本文中的Terraria.Player类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论