示例#1
0
        private void orientActorBound(BoundingBox Tile)
        {
            if (BoxHelper.TouchBottomOf(m_boundingSphere, Tile))
            {
                deltaPosBound.X = 0;
                deltaPosBound.Y = 1;
                m_walkingHoz    = true;
                m_invert        = true;
            }
            if (BoxHelper.TouchTopOf(m_boundingSphere, Tile))
            {
                deltaPosBound.X = 0;
                deltaPosBound.Y = -1;
                m_walkingHoz    = true;
                m_invert        = false;
            }
            if (BoxHelper.TouchLeftOf(m_boundingSphere, Tile))
            {
                deltaPosBound.X = -1;
                deltaPosBound.Y = 0;
                m_walkingVer    = true;
            }
            if (BoxHelper.TouchRightOf(m_boundingSphere, Tile))
            {
                deltaPosBound.X = 1;
                deltaPosBound.Y = 0;
                m_walkingVer    = true;
            }
            m_velocity = Vector2.Normalize(deltaPosBound) * 3;

            if ((m_walkingHoz) && (m_walkingVer))
            {
                playerState  = ActorState.Floating;
                m_walkingHoz = false;
                m_walkingVer = false;
            }

            if (m_boundingSphere.Intersects(Tile))
            {
                m_velocity = m_velocity - m_velocity;
            }
        }