private void CreateUserHealthbar(User user) { var healthFacade = _factory.Create(user, transform); _userHealthbars.Add(user.Id, healthFacade); user.Character.Position.Subscribe(_ => { UpdatePlayersPosition(); Observable.TimerFrame(2, FrameCountType.FixedUpdate).Subscribe(_2 => { UpdatePlayersPosition(); }); }); UpdatePlayersPosition(); }
public static PlayerHealthBar CreateFromData(dynamic jsonData, ContentManager contentManager, GraphicsDevice graphicsDevice, WeaponInventory weaponInventory, GameWorld gameWorld, GameData gameData, HealthBarFactory healthBarFactory, Player player) { var hudComponentDefinition = HudComponentDefinition.Create(jsonData); var healthBar = healthBarFactory.Create("PlayerHealthBar", hudComponentDefinition.Width, hudComponentDefinition.Height); return(new PlayerHealthBar(hudComponentDefinition, player, healthBar)); }