public InfoOverlay(LogicalMap2D logicalMap) { _logicalMap = logicalMap ?? throw new ArgumentNullException(nameof(logicalMap)); // 1 tile padding all around so we don't have to worry about edge conditions in the shader _tiles = new byte[Width * Height]; _logicalMap.Dirty += (sender, args) => { if (args.Type != IconChangeType.Trigger) { return; } int index = _logicalMap.Index(args.X, args.Y); var zone = _logicalMap.GetZone(index); var triggers = zone?.Trigger ?? 0; _tiles[Index(args.X, args.Y)] = BuildTile(triggers); BufferDirty = true; }; On <BeginFrameEvent>(_ => _flags = 0); On <CursorModeEvent>(e => _flags |= e.Mode switch { CursorMode.Examine => InfoOverlayFlags.VerbExamine, CursorMode.Manipulate => InfoOverlayFlags.VerbManipulate, CursorMode.Talk => InfoOverlayFlags.VerbTalk, CursorMode.Take => InfoOverlayFlags.VerbTake, _ => 0 });
public Passability GetPassability(Vector2 tilePosition) => _logicalMap.GetPassability(_logicalMap.Index((int)tilePosition.X, (int)tilePosition.Y));