public void AddComponentTest() { var entity = new RogueLikeEntity((1, 3), Color.Cyan, 2); var component = new PlayerControlsComponent(); Assert.Equal(4, component.Motions.Count); Assert.Empty(component.Actions); entity.AllComponents.Add(component); Assert.Single(entity.SadComponents); Assert.Single(entity.GoRogueComponents); }
public void NewPlayerControlsComponent() { var player = new RogueLikeEntity((0, 0), Color.White, 1); var component = new PlayerControlsComponent(); Assert.Equal(4, component.Motions.Count); Assert.Empty(component.Actions); player.AllComponents.Add(component); Assert.Single(player.SadComponents); Assert.Single(player.GoRogueComponents); }
public Player(Point position, int fovRadius = 10) : base(position, 1, false) { // Set FOV radius we will use for calculating FOV FOVRadius = fovRadius; // Set hook so that FOV is recalculated when the player moves Moved += OnMoved; // Add component for controlling player movement via keyboard var motionControl = new PlayerControlsComponent(); AllComponents.Add(motionControl); }