public NetworkPlayer(byte playerID, NetConnection connection, Vector2 playerPos, string name)
        {
            NetConnection = connection;

            UpdateMask |= 1;
            UpdateMask |= (int)PlayerUpdateFlags.Player_Position;

            this.PlayerID = playerID;
            this.EntityPosition = playerPos;
            this.PlayerName = name;
            EntityVelocity.X = 3;

            PlayerBlockCache = new BlockData[GameServer.WorldSizeX, GameServer.WorldSizeY];

            Inventory = new PlayerInventory(this);
            PClass = new PlayerClassDestroyer(this);

            for (int x = 0; x < GameServer.WorldSizeX; x++)
                for (int y = 0; y < GameServer.WorldSizeY; y++)
                    PlayerBlockCache[x, y] = new BlockData();

            Respawn();
        }
Beispiel #2
0
 /// <summary>
 /// Returns true if a class can pick up this item
 /// </summary>
 /// <param name="pClass">The PlayerClass to test against</param>
 public bool CanPickup(PlayerClass pClass)
 {
     if (_classesCanPickup.Length == 0) return true;
     for(int i = 0; i < PlayerClass.PlayerClasses.Length; i++)
     {
         if(pClass.GetType() == PlayerClass.PlayerClasses[i])
         {
             return CanPickup(i);
         }
     }
     return false;
 }