internal void SetupProjectile(Projectile projectile) { ModProjectile newProjectile = (ModProjectile)Activator.CreateInstance(GetType()); newProjectile.projectile = projectile; projectile.modProjectile = newProjectile; newProjectile.mod = mod; newProjectile.SetDefaults(); }
public int ProjectileType(string name) { ModProjectile projectile = GetProjectile(name); if (projectile == null) { return(0); } return(projectile.projectile.type); }
internal void SetupProjectile(Projectile projectile) { ModProjectile newProjectile = (ModProjectile)(CloneNewInstances ? MemberwiseClone() : Activator.CreateInstance(GetType())); newProjectile.projectile = projectile; projectile.modProjectile = newProjectile; newProjectile.mod = mod; newProjectile.SetDefaults(); }
private void AutoloadProjectile(Type type) { ModProjectile projectile = (ModProjectile)Activator.CreateInstance(type); projectile.mod = this; string name = type.Name; if (projectile.Autoload(ref name)) { AddProjectile(name, projectile); } }
public void AddProjectile(string name, ModProjectile projectile, string texture) { int id = ProjectileLoader.ReserveProjectileID(); projectile.projectile.name = name; projectile.Name = name; projectile.projectile.type = id; projectiles[name] = projectile; ProjectileLoader.projectiles[id] = projectile; projectile.texture = texture; projectile.mod = this; }
private void AutoloadProjectile(Type type) { ModProjectile projectile = (ModProjectile)Activator.CreateInstance(type); projectile.mod = this; string name = type.Name; string texture = (type.Namespace + "." + type.Name).Replace('.', '/'); if (projectile.Autoload(ref name, ref texture)) { AddProjectile(name, projectile, texture); } }
public static void UseGrapple(Player player, ref int type) { ModProjectile modProjectile = GetProjectile(type); if (modProjectile != null) { modProjectile.UseGrapple(player, ref type); } foreach (GlobalProjectile globalProjectile in globalProjectiles) { globalProjectile.UseGrapple(player, ref type); } }
public static bool?SingleGrappleHook(int type, Player player) { bool? flag = null; ModProjectile modProjectile = GetProjectile(type); if (modProjectile != null) { flag = modProjectile.SingleGrappleHook(player); } foreach (GlobalProjectile globalProjectile in globalProjectiles) { bool?singleHook = globalProjectile.SingleGrappleHook(type, player); if (singleHook.HasValue) { flag = singleHook; } } return(flag); }
public static bool?CanUseGrapple(int type, Player player) { bool? flag = null; ModProjectile modProjectile = GetProjectile(type); if (modProjectile != null) { flag = modProjectile.CanUseGrapple(player); } foreach (GlobalProjectile globalProjectile in globalProjectiles) { bool?canGrapple = globalProjectile.CanUseGrapple(type, player); if (canGrapple.HasValue) { flag = canGrapple; } } return(flag); }
/// <summary> /// Create a new instance of this ModProjectile for a Projectile instance. /// Called at the end of Projectile.SetDefaults. /// If CloneNewInstances is true, just calls Clone() /// Otherwise calls the default constructor and copies fields /// </summary> public virtual ModProjectile NewInstance(Projectile projectileClone) { if (CloneNewInstances) { ModProjectile clone = Clone(); clone.projectile = projectileClone; return(clone); } ModProjectile copy = (ModProjectile)Activator.CreateInstance(GetType()); copy.projectile = projectileClone; copy.Mod = Mod; copy.aiType = aiType; copy.cooldownSlot = cooldownSlot; copy.drawOffsetX = drawOffsetX; copy.drawOriginOffsetY = drawOriginOffsetY; copy.drawOriginOffsetX = drawOriginOffsetX; copy.drawHeldProjInFrontOfHeldItemAndArms = drawHeldProjInFrontOfHeldItemAndArms; return(copy); }