public void SetUp() { _systemContainer = Substitute.For <ISystemContainer>(); _entityEngine = Substitute.For <IEntityEngine>(); _systemContainer.EntityEngine.Returns(_entityEngine); _mutableEntities = new List <IEntity>(); _entityEngine.MutableEntities.Returns(_mutableEntities); _mapSystem = Substitute.For <IMapSystem>(); _systemContainer.MapSystem.Returns(_mapSystem); _mapCollection = new Atlas(); _mapSystem.MapCollection.Returns(_mapCollection); _messageSystem = Substitute.For <IMessageSystem>(); _systemContainer.MessageSystem.Returns(_messageSystem); _messages = new List <Message>(); _messageSystem.AllMessages.Returns(_messages); _timeSystem = Substitute.For <ITimeSystem>(); _systemContainer.TimeSystem.Returns(_timeSystem); _currentTime = 0; _timeSystem.CurrentTime.Returns(_currentTime); _worldGenerator = Substitute.For <IWorldGenerator>(); _saveSystem = new SaveSystem(_systemContainer, _worldGenerator); }
public AnimatedMovementSystem(IEntityEngine entityEngine, IStopwatch stopwatch) { _entityEngine = entityEngine; _stopwatch = stopwatch; _lastKnownTime = stopwatch.ElapsedMilliseconds; _stopwatch.Start(); }
public void SetUp() { loader = Substitute.For <IEntityDataProvider>(); loader.GetData().Returns(new List <string>()); engine = new EntityEngine(loader); }
public void SetUp() { SystemContainer = new SystemContainer(); SystemContainer.PositionSystem = Substitute.For <IPositionSystem>(); SystemContainer.EventSystem = Substitute.For <IEventSystem>(); SystemContainer.Random = Substitute.For <IRandom>(); entityEngine = Substitute.For <IEntityEngine>(); entityEngine.New(Arg.Any <string>(), Arg.Any <IEntityComponent[]>()).ReturnsForAnyArgs(callInfo => { var entity = new Entity(0, "entity", callInfo.ArgAt <IEntityComponent[]>(1)); entity.Name = callInfo.ArgAt <string>(0); return(entity); }); entityEngine.Load(Arg.Any <uint>(), Arg.Any <Entity>()).ReturnsForAnyArgs(callInfo => { var entity = callInfo.ArgAt <Entity>(1); return(entity); }); entityEngine.ComponentTypes.ReturnsForAnyArgs(new[] { typeof(Appearance), typeof(Position), typeof(Stairs), typeof(AttackClosestEnemyBehaviour), typeof(Script) }); SystemContainer.EntityEngine = entityEngine; }
public FighterSystem(IEntityEngine engine, IMessageSystem messageSystem, IEventSystem eventRuleSystem, ITimeSystem timeSystem, IStatSystem statSystem) { _engine = engine; _messageSystem = messageSystem; _eventRuleSystem = eventRuleSystem; _timeSystem = timeSystem; _statSystem = statSystem; }
public ItemSystem(IEntityEngine entityEngine, IPrototypeSystem prototypeSystem, IScriptExecutor scriptExecutor, IMessageSystem messageSystem, IEventSystem eventSystem) { this.entityEngine = entityEngine; this.prototypeSystem = prototypeSystem; this.scriptExecutor = scriptExecutor; this.messageSystem = messageSystem; this.eventSystem = eventSystem; }
public FollowPathBehaviour(ISystemContainer systemContainer) { _positionSystem = systemContainer.PositionSystem; _eventRuleSystem = systemContainer.EventSystem; _playerSystem = systemContainer.PlayerSystem; _mapSystem = systemContainer.MapSystem; _entityEngine = systemContainer.EntityEngine; _messageSystem = systemContainer.MessageSystem; _timeSystem = systemContainer.TimeSystem; }
private static PositionSystem SetUpTestPositionSystemWithPathfindingAlgorithm(out IPathfindingAlgorithm pathfindingAlgorithm) { pathfindingAlgorithm = Substitute.For <IPathfindingAlgorithm>(); IEntityEngine entityEngine = Substitute.For <IEntityEngine>(); IMapSystem mapSystem = Substitute.For <IMapSystem>(); mapSystem.MapCollection.Returns(new Atlas() { { new MapKey(TEST_MAP_NAME), Substitute.For <IMap>() } }); var testPositionSystem = new PositionSystem(mapSystem, entityEngine, pathfindingAlgorithm); return(testPositionSystem); }
public BranchLoadingScreenActivity(ISystemContainer systemContainer) : base(systemContainer.ActivitySystem, "Generating branch...", false, null) { _engine = systemContainer.EntityEngine; _displayEntity = systemContainer.EntityEngine.New("branchGenerationTracker", new Appearance { Color = Color.White, Glyph = '@' }, new SpriteAppearance { Bottom = "generic_person" }, new Animated(), new Animation(), new Description { Name = "Branch generation tracker", Detail = "Generating branch..." }); }
private static MenuItem ConvertItemToMenuItem(uint itemId, IEntityEngine entityEngine) { var item = entityEngine.Get(itemId); var itemText = item.Get <Description>().Name; if (item.Has <Stackable>()) { itemText += $" (x{item.Get<Stackable>().StackSize})"; } if (item.Has <Consumable>()) { itemText += $" ({item.Get<Consumable>().Uses})"; } return(new MenuItem(itemText, item.EntityId)); }
public StatSystem(IEntityEngine engine) { _engine = engine; }
public PrototypeSystem(IEntityEngine engine, IPositionSystem positionSystem, ISystemContainer systemContainer) { _engine = engine; _positionSystem = positionSystem; _systemContainer = systemContainer; }
public PositionSystem(IMapSystem mapSystem, IEntityEngine entityEngine, IPathfindingAlgorithm pathfindingAlgorithm) { _mapSystem = mapSystem; _entityEngine = entityEngine; _pathfindingAlgorithm = pathfindingAlgorithm; }
protected virtual List <KeyValuePair <MapCoordinate, Stairs> > GetStairs(IMap map, StairDirection direction, IEntityEngine engine) { return(engine.EntitiesWith <Stairs>() .Where(e => e.Get <Position>().MapCoordinate.Key == map.MapKey) .Where(c => c.Get <Stairs>().Direction == direction) .Select(c => new KeyValuePair <MapCoordinate, Stairs>(c.Get <Position>().MapCoordinate, c.Get <Stairs>())) .ToList()); }
public ParticleSystem(IAnimationSystem animationSystem, IEntityEngine entityEngine) { _animationSystem = animationSystem; _entityEngine = entityEngine; }