Beispiel #1
0
        //----------------------------------------------------------------------
        // Movement & Checking Functions
        //----------------------------------------------------------------------

        private void _CheckCurrentTile(GameTime gameTime)
        {
            int _totalRow          = m_referenceMapData.GetMapTileHeight();
            int _totalCol          = m_referenceMapData.GetMapTileWidth();
            int tileID_CurrentTIle = m_referenceMapData.GetMapTileData(m_referenceMapData.ConvertToMapIdex(m_playerTilePositionY, m_playerTilePositionX, _totalRow, _totalCol));

            if (tileID_CurrentTIle == (int)TileType.PATH)
            {
                m_onHideTile  = false;
                m_hidingTimer = 0.0f;
            }

            if (tileID_CurrentTIle == (int)TileType.EXIT_SIGN)
            {
                m_onExitTile = true;
            }

            if (tileID_CurrentTIle == (int)TileType.HIDE_TILE)
            {
                m_hidingTimer += (gameTime.ElapsedGameTime.TotalSeconds * 7);
                if (m_hidingTimer <= 5.0f)
                {
                    m_onHideTile = true;
                }
                else
                {
                    m_hidingTimer = 0.0f;
                    m_onHideTile  = false;
                    SetTilePosition((int)m_playerPreviousPositionForHideout.X, (int)m_playerPreviousPositionForHideout.Y);
                }
            }
        }
Beispiel #2
0
        //=======================================================
        // Condition Functions
        //=======================================================

        protected bool _PlayerInLineOfSightHorizontalFlag(Vector2 i_playerPosVector)
        {
            int playerX = (int)i_playerPosVector.X;
            int playerY = (int)i_playerPosVector.Y;
            int wizardX = refPosX;
            int wizardY = refPosY;
            int R       = refMap.GetMapTileHeight();
            int C       = refMap.GetMapTileWidth();
            int TileID  = 0;

            //If same Row means different in X, player-wizard Horizontal
            if (wizardY == playerY)
            {
                int _d = playerX - wizardX;
                if (_d > 0) //Player on right side
                {
                    while (_d != 0)
                    {
                        TileID = refMap.GetMapTileData(refMap.ConvertToMapIdex(wizardY, wizardX + 1, R, C));

                        if (TileID == 00)
                        {
                            wizardX++;
                            _d--;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
                else //Player on left side
                {
                    while (_d != 0)
                    {
                        TileID = refMap.GetMapTileData(refMap.ConvertToMapIdex(wizardY, wizardX - 1, R, C));

                        if (TileID == 00)
                        {
                            wizardX--;
                            _d++;
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
            }
            return(false);
        }