private static FinalBossShot FinalBossShotOnInit_FinalBoss_Player_float( On.Celeste.FinalBossShot.orig_Init_FinalBoss_Player_float orig, FinalBossShot self, FinalBoss boss, Player target, float angleOffset) { self.TrySetEntityId2(boss.HasEntityId2() ? boss.GetEntityId2().ToString() : "null", target.GetEntityId2(), angleOffset); return(orig(self, boss, target, angleOffset)); }
private static FinalBossShot FinalBossShotOnInit_FinalBoss_Vector2( On.Celeste.FinalBossShot.orig_Init_FinalBoss_Vector2 orig, FinalBossShot self, FinalBoss boss, Vector2 target) { // 区分连发的炮弹 int index = 0; if (Engine.Scene.GetLevel() is Level level) { index = level.Entities.Count(entity => entity is FinalBossShot); } self.TrySetEntityId2(boss.HasEntityId2() ? boss.GetEntityId2().ToString() : "null", target, index); return(orig(self, boss, target)); }
public static FinalBossShot Clone(this FinalBossShot finalBossShot) { FinalBoss boss = finalBossShot.GetField("boss")?.TryFindOrCloneObject() as FinalBoss; if (boss == null) { return(null); } if (finalBossShot.GetField("target") == null) { return(Engine.Pooler.Create <FinalBossShot>() .Init(boss, (Vector2)finalBossShot.GetField("targetPt"))); } if (Engine.Scene.GetPlayer() is Player player) { return(Engine.Pooler.Create <FinalBossShot>() .Init(boss, player, (float)finalBossShot.GetField("angleOffset"))); } return(null); }