2 using FBLibrary.Core.BaseEntities;
3 using Microsoft.Xna.Framework;
6 namespace FBServer.Core
10 private TimeSpan _destructionTimer;
12 private readonly
Timer _tmrSendPos =
new Timer(
true);
17 _destructionTimer = DestructionTime;
23 _destructionTimer = DestructionTime;
29 CurrentDirection = direction;
32 PreviousDirection = direction;
43 switch (CurrentDirection)
45 case LookDirection.Down:
46 Position +=
new Vector2(0, GetMovementSpeed());
48 case LookDirection.Up:
49 Position +=
new Vector2(0, -GetMovementSpeed());
51 case LookDirection.Left:
52 Position +=
new Vector2(-GetMovementSpeed(), 0);
54 case LookDirection.Right:
55 Position +=
new Vector2(GetMovementSpeed(), 0);
65 ComputeWallCollision(map);
68 if (CurrentDirection != PreviousDirection)
74 if (_tmrSendPos.Each(ServerSettings.SendPlayerPositionTime))
80 _destructionTimer -= TimeSpan.FromMilliseconds(GameSettings.Speed);
82 if (_destructionTimer <= TimeSpan.Zero)
91 PreviousDirection = CurrentDirection;
95 private void SendPosition()
97 GameSettings.GameServer.SendPlayerPosition(
this,
false);
102 float rtn = (
Speed * GameSettings.Speed) / 1000f;
108 return GameSettings.Speed;
113 InDestruction =
true;
override float GetMovementSpeed()
Player(int id, PlayerStats stats)
void MovePlayer(BaseMap map)
void SetMovement(LookDirection direction)