public GhostInputReplayer(Game game, GhostData data) : base(game) { Data = data; On.Celeste.Input.Initialize += HookInput; HookInput(null); }
public GhostManager(Player player, Level level) : base(Vector2.Zero) { Player = player; Tag = Tags.HUD; // Read and add all ghosts. GhostData.ForAllGhosts(level.Session, (i, ghostData) => { Ghost ghost = new Ghost(player, ghostData); level.Add(ghost); Ghosts.Add(ghost); return(true); }); }
public Ghost(Player player, GhostData data) : base(player.Position) { Player = player; Data = data; Depth = 1; Sprite = new PlayerSprite(player.Sprite.Mode); Sprite.HairCount = player.Sprite.HairCount; Add(Hair = new PlayerHair(Sprite)); Add(Sprite); Hair.Color = Player.NormalHairColor; Name = new GhostName(this, Data?.Name ?? ""); }
public static List <GhostData> ReadAllGhosts(Session session, List <GhostData> list = null) { if (list == null) { list = new List <GhostData>(); } foreach (string filePath in GetAllGhostFilePaths(session)) { GhostData ghost = new GhostData(filePath).Read(); if (ghost == null) { continue; } list.Add(ghost); } return(list); }
public static void ForAllGhosts(Session session, Func <int, GhostData, bool> cb) { if (cb == null) { return; } string[] filePaths = GetAllGhostFilePaths(session); for (int i = 0; i < filePaths.Length; i++) { GhostData ghost = new GhostData(filePaths[i]).Read(); if (ghost == null) { continue; } if (!cb(i, ghost)) { break; } } }