本文整理匯總了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;
}
示例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;
}
示例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);
}
示例4: PostLoad
public static void PostLoad(Player p)
{
magicFindBonus = 0f; //Reset bonus
oldHealth = p.statLifeMax;
oldMana = p.statManaMax;
}
示例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"));
}
}
示例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;
}
示例7: TSPlayer
protected TSPlayer(String playerName)
{
TilesDestroyed = new Dictionary<Vector2, Tile>();
Index = -1;
FakePlayer = new Player { name = playerName, whoAmi = -1 };
Group = new Group("null");
}
示例8: UpdateVanitySet
public virtual void UpdateVanitySet(Player player)
{
if (item != null)
{
item.UpdateVanitySet(player);
}
}
示例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);
}
}
示例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);
}
}
示例11: UpdateVanity
public virtual void UpdateVanity(Player player, EquipType type)
{
if (item != null)
{
item.UpdateVanity(player, type);
}
}
示例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);
}
}
}
}
示例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);
}
}
}
示例14: OnHitNPC
public override void OnHitNPC(Player player, NPC target, int damage, float knockBack, bool crit)
{
if(!target.boss)
{
target.velocity.Y -= 5;
}
}
示例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;
}