Advertisement
Guest User

Untitled

a guest
Jul 18th, 2016
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.46 KB | None | 0 0
  1. public class ShipObject
  2. {
  3.    
  4. }
  5.  
  6. public class ShipsContainer
  7. {
  8.     private Dictionary<int, ShipObject> m_ShipDict;
  9.  
  10.     public void AddShip(ShipObject ship)
  11.     {
  12.         m_ShipDict.Add (ship.GetHashCode (), ship);
  13.     }
  14.  
  15.     public ShipObject GetShipByHash(int hash)
  16.     {
  17.         return m_ShipDict [hash];
  18.     }
  19.  
  20.     public void RemoveShip(int hash)
  21.     {
  22.         if (m_ShipDict.ContainsKey (hash))
  23.         {
  24.             m_ShipDict.Remove (hash);
  25.             return;
  26.         }
  27.  
  28.         Debug.Log ("Ship not found!");
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement