コード例 #1
0
ファイル: WalkController.cs プロジェクト: DmitryMI/TileEngine
 public bool CanPass(Vector2Int cell)
 {
     if (ServerController.IsCellInBounds(cell))
     {
         return(_walkBlockerCount[cell.x, cell.y] == 0);
     }
     return(false);
 }
コード例 #2
0
        public TileObject[] GetObjects(int x, int y)
        {
            if (WasLoaded && ServerController.IsCellInBounds(x, y))
            {
                return(_objects[x, y].ToArray());
            }

            return(null);
        }
コード例 #3
0
        public void RemoveObject(int x, int y, TileObject obj)
        {
            if (WasLoaded && ServerController.IsCellInBounds(x, y))
            {
                _objects[x, y].Remove(obj);

                Item item = obj as Item;
                if (item)
                {
                    _itemStackCollection.Remove(item, new Vector2Int(x, y));
                }
            }
        }
コード例 #4
0
        public void AddObject(int x, int y, TileObject obj)
        {
            if (WasLoaded && ServerController.IsCellInBounds(x, y))
            {
                _objects[x, y].Add(obj);
                if (isServer)
                {
                    Item item = obj as Item;
                    if (item)
                    {
                        _itemStackCollection.Add(item, new Vector2Int(x, y));
                    }
                }
            }

            if (!WasLoaded)
            {
                Debug.Log("Detected attempt to registrate object before launching TileController. This can cause malfunctions");
            }
        }