public bool Exit(GameClient client)
        {
            if (_topPlayer?.Client.Equals(client) ?? false)
            {
                _fieldObjects.Remove(_topPlayer);
                _topPlayer = null;
                Reset();
                return(true);
            }

            if (_bottomPlayer?.Client.Equals(client) ?? false)
            {
                _fieldObjects.Remove(_bottomPlayer);
                _bottomPlayer = null;
                Reset();
                return(true);
            }

            return(false);
        }
 public void Enter(IFieldPlayer player)
 {
     if (_topPlayer == null)
     {
         _topPlayer      = player;
         player.Position = TopStartingPosition.Clone();
         player.AcceptField(this);
         _fieldObjects.Add(_topPlayer);
     }
     else if (_bottomPlayer == null)
     {
         _bottomPlayer   = player;
         player.Position = BottomStatingPosition.Clone();
         player.AcceptField(this);
         _fieldObjects.Add(_bottomPlayer);
     }
     else
     {
         throw new Exception("Field is full!");
     }
 }
Exemplo n.º 3
0
 public Projectile(IFieldPlayer parent)
 {
     _parent = parent;
 }