static ThingLens() { Id = Lens.Create <Thing, long>( thing => thing.Id, id => thing => thing.With(id: id)); ThingType = Lens.Create <Thing, ThingTypes>( thing => thing.ThingType, thingType => thing => thing.With(thingType: thingType)); Name = Lens.Create <Thing, string>( thing => thing.Name, name => thing => thing.With(name: name)); ValidSlots = Lens.Create <Thing, ISlotList>( thing => thing.ValidSlots, validSlots => thing => thing.With(validSlots: validSlots)); EquipableAs = Lens.Create <Thing, IMaybe <EquipmentSlots> >( thing => thing.EquipedAs, equipedAs => thing => thing.With(equipedAs: equipedAs)); CombatStatistics = Lens.Create <Thing, IMaybe <CombatStatistics> >( thing => thing.CombatStatistics, combatStatistics => thing => thing.With(combatStatistics: combatStatistics)); Contains = Lens.Create <Thing, IThingStore>( thing => thing.Contains, contains => thing => thing.With(contains: contains)); }
static ActorLens() { Id = Lens.Create <Actor, long>( actor => actor.Id, id => actor => actor.With(id: id)); ActorType = Lens.Create <Actor, ActorTypes>( actor => actor.ActorType, actorType => actor => actor.With(actorType: actorType)); Name = Lens.Create <Actor, string>( actor => actor.Name, name => actor => actor.With(name: name)); Statistics = Lens.Create <Actor, IStatisticsStore>( actor => actor.Statistics, statistics => actor => actor.With(statistics: statistics)); HitPoints = Lens.Create <Actor, HitPoints>( actor => actor.HitPoints, hitPoints => actor => actor.With(hitPoints: hitPoints)); Things = Lens.Create <Actor, IThingStore>( actor => actor.Things, things => actor => actor.With(things: things)); }
static HitPointsLens() { Maximum = Lens.Create <HitPoints, int>( hitPoints => hitPoints.Maximum, maximum => hitPoints => hitPoints.With(maximum: maximum)); Current = Lens.Create <HitPoints, int>( hitPoints => hitPoints.Current, current => hitPoints => hitPoints.With(current: current)); }
static LevelLens() { Tiles = Lens.Create <Level, ITileStore>( level => level.Tiles, tile => level => level.With(tiles: tile)); ActorStates = Lens.Create <Level, IActorStateStore>( level => level.ActorStates, actorStates => level => level.With(actorStates: actorStates)); }
static ActorStateLens() { Actor = Lens.Create <ActorState, Actor>( actorState => actorState.Actor, actor => actorState => actorState.With(actor: actor)); Location = Lens.Create <ActorState, Vector>( actorState => actorState.Location, location => actorState => actorState.With(location: location)); }
static TileLens() { TileType = Lens.Create <Tile, TileTypes>( tile => tile.TileType, tileType => tile => tile.With(tileType: tileType)); Name = Lens.Create <Tile, string>( tile => tile.Name, name => tile => tile.With(name: name)); ActorId = Lens.Create <Tile, IMaybe <long> >( tile => tile.ActorId, actorId => tile => tile.With(actorId: actorId)); Things = Lens.Create <Tile, IThingStore>( tile => tile.Things, things => tile => tile.With(things: things)); }