public CustomProjectile GetCustomProjectile(Projectile projectile) { CustomProjectile customProjectile = null; Debug.Assert(projectile != null, "projectile cannot be null."); if (projectile != null) { customProjectiles.TryGetValue(projectile, out customProjectile); } return(customProjectile); }
private CustomProjectile AttachCustomProjectile(Projectile projectile, ProjectileDefinition definition) { var customProjectile = new CustomProjectile(projectile, definition); customProjectiles.Remove(projectile); customProjectiles.Add(projectile, customProjectile); definition.ApplyTo(projectile); try { CustomIDFunctions.CurrentID = definition.Name; definition.OnSpawn?.Invoke(customProjectile); } catch (Exception ex) { Utils.LogScriptRuntimeError(ex); definition.OnSpawn = null; } return(customProjectile); }