private void OnMove(object sender, EntityMovedEventArgs args) { if (FieldOfViewRadius > 0) { // Re-calculate the field of view FieldOfView.Calculate(Position, FieldOfViewRadius); } }
public override void OnMove(object sender, EntityMovedEventArgs args) { // Handles flashlight lights GridManager.Grid.LightEngine.HandleFlashlight(this); // OnMove will redraw fov, and flashlight needs to be handled before that base.OnMove(sender, args); // Update visible objects in fov window _fovObjectsWindow.Update(this); }
// Handle the case where you set the position when its casted to Entity private void SadConsole_Moved(object sender, EntityMovedEventArgs e) { if ((Point)Position != base.Position) { Position = base.Position; } if ((Point)Position != base.Position) // GoRogue wouldn't allow the position set { base.Position = Position; // Set it back. This shouldn't infinite loop because Position is still equal to the old base.Position } }
private void OnMove(object sender, EntityMovedEventArgs args) { if (FieldOfViewRadius > 0) { // Re-calculate the field of view FieldOfView.Calculate(Position, FieldOfViewRadius); // Only update visual for player entity if (this is Player) { GridManager.Grid.DrawFieldOfView(this); } } }
// Handle the case where SadConsole's Position property was the one that initiated the move private void SadConsole_Moved(object sender, EntityMovedEventArgs e) { if (Position != base.Position) { Position = base.Position; // In this case, GoRogue wouldn't allow the position set, so set SadConsole's position back to the way it was // to keep them in sync. Since GoRogue's position never changed, this won't infinite loop. if (Position != base.Position) { base.Position = Position; } } }
private void EntitiesOnMoved(object sender, EntityMovedEventArgs e) { // We have already changed entity's path, just have to make sure the list is still // sorted. EnqueueRequest(new ModifyRequest(e.Value)); }