コード例 #1
0
        public void RefreshPassable(LogicGameObject gameObject)
        {
            if (gameObject.IsStaticObject())
            {
                int tileX = gameObject.GetTileX();
                int tileY = gameObject.GetTileY();

                if (tileX >= 0 && tileY >= 0)
                {
                    int sizeX = gameObject.GetWidthInTiles();
                    int sizeY = gameObject.GetHeightInTiles();

                    for (int i = 0; i < sizeY; i++)
                    {
                        for (int j = 0; j < sizeX; j++)
                        {
                            LogicTile tile = this.GetTile(tileX + j, tileY + i);
                            Debugger.DoAssert(tile != null, "illegal tile index");
                            tile.RefreshPassableFlag();
                        }
                    }

                    this.UpdateRoomIndices();
                }
            }
        }
コード例 #2
0
        /// <summary>
        ///     Refreshes passable of the specified <see cref="LogicGameObject"/> instance..
        /// </summary>
        public void RefreshPassable(LogicGameObject gameObject)
        {
            if (gameObject.IsStaticObject())
            {
                int tileX = gameObject.GetTileX();
                int tileY = gameObject.GetTileY();

                if (tileX >= 0)
                {
                    if (tileY >= 0)
                    {
                        int sizeX = gameObject.GetWidthInTiles();
                        int sizeY = gameObject.GetHeightInTiles();

                        for (int i = 0; i < sizeY; i++)
                        {
                            for (int j = 0; j < sizeX; j++)
                            {
                                this.GetTile(tileX + j, tileY + i).RefreshPassableFlag();
                            }
                        }

                        if (!gameObject.IsPassable())
                        {
                            this.UpdateRoomIndices();
                        }
                    }
                }
            }
        }
コード例 #3
0
        public void RemoveGameObject(LogicGameObject gameObject)
        {
            if (gameObject.IsStaticObject())
            {
                int tileX = gameObject.GetTileX();
                int tileY = gameObject.GetTileY();

                if (tileX >= 0 && tileY >= 0)
                {
                    int sizeX = gameObject.GetWidthInTiles();
                    int sizeY = gameObject.GetHeightInTiles();

                    for (int i = 0; i < sizeY; i++)
                    {
                        for (int j = 0; j < sizeX; j++)
                        {
                            this.m_tiles[(tileX + j) + this.m_sizeX * (tileY + i)].RemoveGameObject(gameObject);
                        }
                    }

                    if (!gameObject.IsPassable())
                    {
                        this.UpdateRoomIndices();
                    }
                }
            }
        }
コード例 #4
0
        /// <summary>
        ///     Called when the specified gameobject has been moved.
        /// </summary>
        public void GameObjectMoved(LogicGameObject gameObject, int oldTileX, int oldTileY)
        {
            if (gameObject.IsStaticObject())
            {
                int tileX = gameObject.GetTileX();
                int tileY = gameObject.GetTileY();

                if (tileX >= 0)
                {
                    if (tileY >= 0)
                    {
                        int sizeX = gameObject.GetWidthInTiles();
                        int sizeY = gameObject.GetHeightInTiles();

                        for (int i = 0; i < sizeY; i++)
                        {
                            for (int j = 0; j < sizeX; j++)
                            {
                                this.GetTile(oldTileX + j, oldTileY + i).RemoveGameObject(gameObject);
                                this.GetTile(tileX + j, tileY + i).AddGameObject(gameObject);
                            }
                        }

                        if (!gameObject.IsPassable())
                        {
                            this.UpdateRoomIndices();
                        }
                    }
                }
            }
        }