public static void assignXP(float xp, int level, HitMe hitme, Firearm firearm, Vector3 pos, EffectType type) { if (xp <= 0) { // Debug.LogError("WTF " + xp + " " + hitme.gameObject.name + "\n"); return; } if (firearm == null) { return; } float return_xp = firearm.addXp(xp, true);//if tower is at max xp, return the xp, // if xp is from damage done, it is tied to health. Otherwise, //if xp is from Speed/Teleport/Weaken etc, just assign the XP. this is handled by HitMe.stats.getXp though if (return_xp > 0) { hitme.stats.returnXp(return_xp); } float added = xp - return_xp; onXpAdded?.Invoke(added, pos); firearm.toy.my_tower_stats.addXp(type, level, xp); }