public void RefreshPlayerValuesFromState(IPlayer player) { // TODO: Implement a rolling average player.UpdatePositionFromNetwork(this.Position, 0.1f); player.Health = this.Health; player.Status = this.Status; if (player.Status == player.PendingStatus) { // When the PendingStatus is achieved, we can reset it player.PendingStatus = null; } foreach (var shot in this.NewShots) { player.Shoot(shot.EndPoint); } player.PlayerScore.Kills = this.Score.Kills; player.PlayerScore.Deaths = this.Score.Deaths; }
public void LocalPlayerPositionNotUpdatedFromNetwork() { player = new LocalPlayer(stubPlayerSettings, stubPhysicsComponent, stubBoundaryCollider, stubWeapons, stubTimer); player.Position = new Vector2(100, 200); player.UpdatePositionFromNetwork(new Vector2(300, 400), 1f); Assert.AreEqual(new Vector2(100, 200), player.Position); }