本文整理汇总了C#中Terraria.Projectile类的典型用法代码示例。如果您正苦于以下问题:C# Projectile类的具体用法?C# Projectile怎么用?C# Projectile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Projectile类属于Terraria命名空间,在下文中一共展示了Projectile类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PreAI
public override bool PreAI(Projectile projectile)
{
if (projectile.aiStyle == 52)
{
Player player = Main.player[(int)projectile.ai[0]];
Vector2 center = new Vector2(projectile.position.X + projectile.width * 0.5f, projectile.position.Y + projectile.height * 0.5f);
float offsetX = player.Center.X - center.X;
float offsetY = player.Center.Y - center.Y;
float distance = (float)Math.Sqrt(offsetX * offsetX + offsetY * offsetY);
if (distance < 50f && projectile.position.X < player.position.X + player.width && projectile.position.X + projectile.width > player.position.X && projectile.position.Y < player.position.Y + player.height && projectile.position.Y + projectile.height > player.position.Y)
{
if (projectile.owner == Main.myPlayer && !Main.player[Main.myPlayer].moonLeech)
{
int heal = (int)projectile.ai[1];
int damage = player.statLifeMax2 - player.statLife;
if (heal > damage)
{
heal = damage;
}
if (heal > 0)
{
player.AddBuff(mod.BuffType("Undead2"), 2 * heal, false);
}
}
}
}
return base.PreAI(projectile);
}
开发者ID:DrakoGlyph,项目名称:tModLoader,代码行数:28,代码来源:HealProj.cs
示例2: CanHitNPC
//in Terraria.Projectile.Damage for damaging NPCs before flag2 is checked... just check the patch files
internal static bool? CanHitNPC(Projectile projectile, NPC target)
{
bool? flag = null;
foreach (GlobalProjectile globalProjectile in globalProjectiles)
{
bool? canHit = globalProjectile.CanHitNPC(projectile, target);
if (canHit.HasValue && !canHit.Value)
{
return false;
}
if (canHit.HasValue)
{
flag = canHit.Value;
}
}
if (IsModProjectile(projectile))
{
bool? canHit = projectile.modProjectile.CanHitNPC(target);
if (canHit.HasValue && !canHit.Value)
{
return false;
}
if (canHit.HasValue)
{
flag = canHit.Value;
}
}
return flag;
}
开发者ID:Phantom139,项目名称:tModLoader,代码行数:30,代码来源:ProjectileLoader.cs
示例3: SetupProjectile
internal void SetupProjectile(Projectile projectile)
{
ModProjectile newProjectile = (ModProjectile)Activator.CreateInstance(GetType());
newProjectile.projectile = projectile;
projectile.modProjectile = newProjectile;
newProjectile.mod = mod;
newProjectile.SetDefaults();
}
开发者ID:DrakoGlyph,项目名称:tModLoader,代码行数:8,代码来源:ModProjectile.cs
示例4: OnColliding
internal static bool OnColliding(Projectile pr, Rectangle p, Rectangle t)
{
var bh = pr.P_BHandler as ProjBHandler;
if (bh == null)
return pr.RealColliding(p, t);
return bh.IsColliding(p, t);
}
开发者ID:TerrariaPrismTeam,项目名称:Prism,代码行数:9,代码来源:ProjHooks.cs
示例5: SetupProjectile
internal void SetupProjectile(Projectile projectile)
{
ModProjectile newProjectile = (ModProjectile)(CloneNewInstances ? MemberwiseClone()
: Activator.CreateInstance(GetType()));
newProjectile.projectile = projectile;
projectile.modProjectile = newProjectile;
newProjectile.mod = mod;
newProjectile.SetDefaults();
}
开发者ID:JavidPack,项目名称:TerraCustom,代码行数:9,代码来源:ModProjectile.cs
示例6: AI
internal static void AI(Projectile projectile)
{
if (IsModProjectile(projectile))
{
projectile.modProjectile.AI();
}
foreach (GlobalProjectile globalProjectile in globalProjectiles)
{
globalProjectile.AI(projectile);
}
}
开发者ID:Phantom139,项目名称:tModLoader,代码行数:11,代码来源:ProjectileLoader.cs
示例7: OnKill
internal static void OnKill(Projectile pr)
{
var bh = pr.P_BHandler as ProjBHandler;
if (bh == null || bh.PreDestroyed())
{
pr.RealKill();
if (bh != null)
bh.OnDestroyed();
}
}
开发者ID:TerrariaPrismTeam,项目名称:Prism,代码行数:12,代码来源:ProjHooks.cs
示例8: OnAI
internal static void OnAI(Projectile pr)
{
var bh = pr.P_BHandler as ProjBHandler;
if (bh == null || bh.PreAI())
{
pr.RealAI();
if (bh != null)
bh.OnAI();
}
}
开发者ID:TerrariaPrismTeam,项目名称:Prism,代码行数:12,代码来源:ProjHooks.cs
示例9: OnSetDefaults
public static void OnSetDefaults(ref int type, Projectile proj)
{
if (SetDefaults == null)
{
return;
}
SetDefaultsEventArgs<Projectile, int> setDefaultsEventArgs = new SetDefaultsEventArgs<Projectile, int>
{
Object = proj,
Info = type
};
SetDefaults(setDefaultsEventArgs);
type = setDefaultsEventArgs.Info;
}
开发者ID:Icehawk78,项目名称:TerrariaAPI-Server,代码行数:14,代码来源:ProjectileHooks.cs
示例10: CanHitPlayer
//in Terraria.Projectile.Damage for damaging my player, add this before collision check
internal static bool CanHitPlayer(Projectile projectile, Player target, ref int cooldownSlot)
{
foreach (GlobalProjectile globalProjectile in globalProjectiles)
{
if (!globalProjectile.CanHitPlayer(projectile, target, ref cooldownSlot))
{
return false;
}
}
if (IsModProjectile(projectile))
{
return projectile.modProjectile.CanHitPlayer(target, ref cooldownSlot);
}
return true;
}
开发者ID:Phantom139,项目名称:tModLoader,代码行数:16,代码来源:ProjectileLoader.cs
示例11: SetupProjectile
//in Terraria.Projectile.SetDefaults get rid of bad type check
//in Terraria.Projectile.SetDefaults before scaling size call ProjectileLoader.SetupProjectile(this);
internal static void SetupProjectile(Projectile projectile)
{
projectile.projectileInfo.Clear();
foreach (ProjectileInfo info in infoList)
{
projectile.projectileInfo.Add(info.Clone());
}
if (IsModProjectile(projectile))
{
GetProjectile(projectile.type).SetupProjectile(projectile);
}
foreach (GlobalProjectile globalProjectile in globalProjectiles)
{
globalProjectile.SetDefaults(projectile);
}
}
开发者ID:DrakoGlyph,项目名称:tModLoader,代码行数:18,代码来源:ProjectileLoader.cs
示例12: OnUpdate
internal static void OnUpdate(Projectile pr, int id)
{
if (!pr.active)
return;
pr.whoAmI = id;
pr.numUpdates = pr.extraUpdates;
var bh = pr.P_BHandler as ProjBHandler;
if (bh == null || bh.PreUpdate())
{
pr.RealUpdate(id);
if (bh != null)
bh.OnUpdate();
}
}
开发者ID:TerrariaPrismTeam,项目名称:Prism,代码行数:18,代码来源:ProjHooks.cs
示例13: FillVanilla
/// <summary>
/// Adds all the original vanilla projectiles.
/// </summary>
internal static void FillVanilla()
{
for (int i = -65; i < ProjectileID.Count; i++)
{
if (i == 0)
continue;
Projectile p = new Projectile();
p.SetDefaults(i);
ProjectileDef def = new ProjectileDef();
def.InternalName = p.name;
def.Type = p.type;
CopyProjectileToDef(def, p);
DefFromType.Add(i, def);
VanillaDefFromName.Add(p.name, def);
}
}
开发者ID:chatrat12,项目名称:Prism,代码行数:24,代码来源:ProjectileDefHandler.cs
示例14: ExplosionEffect
public static void ExplosionEffect(Projectile p)
{
Main.PlaySound(2, (int)p.position.X, (int)p.position.Y, 14);
for (int num500 = 0; num500 < 10; num500++)
{
Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 31, 0f, 0f, 100, default(Color), 1.5f);
}
for (int num501 = 0; num501 < 5; num501++)
{
int num502 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 6, 0f, 0f, 100, default(Color), 2.5f);
Main.dust[num502].noGravity = true;
Main.dust[num502].velocity *= 3f;
num502 = Dust.NewDust(new Vector2(p.position.X, p.position.Y), p.width, p.height, 6, 0f, 0f, 100, default(Color), 1.5f);
Main.dust[num502].velocity *= 2f;
}
int num503 = Gore.NewGore(new Vector2(p.position.X, p.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num503].velocity *= 0.4f;
Gore expr_105D2_cp_0 = Main.gore[num503];
expr_105D2_cp_0.velocity.X = expr_105D2_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.1f;
Gore expr_10602_cp_0 = Main.gore[num503];
expr_10602_cp_0.velocity.Y = expr_10602_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.1f;
num503 = Gore.NewGore(new Vector2(p.position.X, p.position.Y), default(Vector2), Main.rand.Next(61, 64), 1f);
Main.gore[num503].velocity *= 0.4f;
Gore expr_10696_cp_0 = Main.gore[num503];
expr_10696_cp_0.velocity.X = expr_10696_cp_0.velocity.X + (float)Main.rand.Next(-10, 11) * 0.1f;
Gore expr_106C6_cp_0 = Main.gore[num503];
expr_106C6_cp_0.velocity.Y = expr_106C6_cp_0.velocity.Y + (float)Main.rand.Next(-10, 11) * 0.1f;
if (p.owner == Main.myPlayer)
{
p.penetrate = -1;
p.position.X = p.position.X + (float)(p.width / 2);
p.position.Y = p.position.Y + (float)(p.height / 2);
p.width = 48;
p.height = 48;
p.position.X = p.position.X - (float)(p.width / 2);
p.position.Y = p.position.Y - (float)(p.height / 2);
p.Damage();
}
}
开发者ID:thegamingboffin,项目名称:Ulterraria_Reborn_GitHub,代码行数:39,代码来源:UlterrariaProjectiles.cs
示例15: ModifyHitByProjectile
public virtual void ModifyHitByProjectile(Projectile projectile, ref int damage, ref float knockback, ref bool crit)
{
}
开发者ID:guyde2011,项目名称:tModLoader,代码行数:3,代码来源:ModNPC.cs
示例16: CanBeHitByProjectile
public virtual bool? CanBeHitByProjectile(Projectile projectile)
{
return null;
}
开发者ID:guyde2011,项目名称:tModLoader,代码行数:4,代码来源:ModNPC.cs
示例17: Update
//.........这里部分代码省略.........
else
{
npc[num14].UpdateNPC(num14);
}
}
for (int num15 = 0; num15 < 200; num15++)
{
if (ignoreErrors)
{
try
{
gore[num15].Update();
}
catch
{
gore[num15] = new Gore();
}
}
else
{
gore[num15].Update();
}
}
for (int num16 = 0; num16 < 0x3e8; num16++)
{
if (ignoreErrors)
{
try
{
projectile[num16].Update(num16);
}
catch
{
projectile[num16] = new Projectile();
}
}
else
{
projectile[num16].Update(num16);
}
}
for (int num17 = 0; num17 < 200; num17++)
{
if (ignoreErrors)
{
try
{
item[num17].UpdateItem(num17);
}
catch
{
item[num17] = new Item();
}
}
else
{
item[num17].UpdateItem(num17);
}
}
if (ignoreErrors)
{
try
{
Dust.UpdateDust();
}
catch
开发者ID:Heloo88,项目名称:ModTerraria_Heloo,代码行数:67,代码来源:Main.cs
示例18: Initialize
//.........这里部分代码省略.........
tileName[0x4d] = "Hellforge";
tileName[0x56] = "Loom";
tileName[0x5e] = "Keg";
tileName[0x60] = "Cooking Pot";
tileName[0x65] = "Bookcase";
tileName[0x6a] = "Sawmill";
tileName[0x72] = "Tinkerer's Workshop";
tileName[0x85] = "Adamantite Forge";
tileName[0x86] = "Mythril Anvil";
for (int n = 0; n < maxMenuItems; n++)
{
this.menuItemScale[n] = 0.8f;
}
for (int num7 = 0; num7 < 0x7d1; num7++)
{
dust[num7] = new Dust();
}
for (int num8 = 0; num8 < 0xc9; num8++)
{
Main.item[num8] = new Item();
}
for (int num9 = 0; num9 < 0xc9; num9++)
{
npc[num9] = new NPC();
npc[num9].whoAmI = num9;
}
for (int num10 = 0; num10 < 0x100; num10++)
{
player[num10] = new Player();
}
for (int num11 = 0; num11 < 0x3e9; num11++)
{
projectile[num11] = new Projectile();
}
for (int num12 = 0; num12 < 0xc9; num12++)
{
gore[num12] = new Gore();
}
for (int num13 = 0; num13 < 100; num13++)
{
cloud[num13] = new Cloud();
}
for (int num14 = 0; num14 < 100; num14++)
{
combatText[num14] = new CombatText();
}
for (int num15 = 0; num15 < 20; num15++)
{
itemText[num15] = new ItemText();
}
for (int num16 = 0; num16 < maxItemTypes; num16++) //CHANGED, orig 0x25b
{
Item item = new Item();
item.SetDefaults(num16, false);
itemName[num16] = item.name;
if (item.headSlot > 0)
{
Item.headType[item.headSlot] = item.type;
}
if (item.bodySlot > 0)
{
Item.bodyType[item.bodySlot] = item.type;
}
if (item.legSlot > 0)
{
开发者ID:Heloo88,项目名称:ModTerraria_Heloo,代码行数:67,代码来源:Main.cs
示例19: InvokeProjectileAIUpdate
internal bool InvokeProjectileAIUpdate(Projectile projectile)
{
ProjectileAiUpdateEventArgs args = new ProjectileAiUpdateEventArgs
{
Projectile = projectile
};
this.ProjectileAIUpdate.Invoke(args);
return args.Handled;
}
开发者ID:Celant,项目名称:TerrariaAPI-Server,代码行数:11,代码来源:HookManager.cs
示例20: InvokeProjectileTriggerPressurePlate
internal bool InvokeProjectileTriggerPressurePlate(Projectile projectile, int tileX, int tileY)
{
TriggerPressurePlateEventArgs<Projectile> args = new TriggerPressurePlateEventArgs<Projectile>
{
Object = projectile,
TileX = tileX,
TileY = tileY
};
this.ProjectileTriggerPressurePlate.Invoke(args);
return args.Handled;
}
开发者ID:Celant,项目名称:TerrariaAPI-Server,代码行数:13,代码来源:HookManager.cs
注:本文中的Terraria.Projectile类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论