GrandLarceny.Player.hang C# (CSharp) 메소드

hang() 공개 메소드

public hang ( Entity a_collider ) : void
a_collider Entity
리턴 void
        public void hang(Entity a_collider)
        {
            if (!m_stunned)
            {
                Rectangle t_colliderBox = a_collider.getHitBox().getOutBox();
                Rectangle t_playerBox = getHitBox().getOutBox();
                if (!t_colliderBox.Contains((int)m_lastPosition.X + t_playerBox.Width + 4, (int)m_lastPosition.Y)
                    && t_colliderBox.Contains((int)m_position.getGlobalX() + t_playerBox.Width + 4, (int)m_position.getGlobalY())
                    && m_lastPosition.Y < t_colliderBox.Y
                    && m_speed.Y >= 0
                    && (m_currentState == State.Jumping || m_currentState == State.Slide))
                {
                    m_position.setLocalY(a_collider.getPosition().getGlobalY());
                    m_nextPosition.Y = m_position.getGlobalY();
                    m_speed.Y = 0;
                    m_speed.X = 0;
                    m_currentState = State.Hanging;
                    m_facingRight = true;
                    m_hangSound.play();
                }
                else if (!t_colliderBox.Contains((int)m_lastPosition.X - 4, (int)m_lastPosition.Y)
                    && t_colliderBox.Contains((int)m_position.getGlobalX() - 4, (int)m_position.getGlobalY())
                    && m_lastPosition.Y < t_colliderBox.Y
                    && m_speed.Y >= 0
                    && (m_currentState == State.Jumping || m_currentState == State.Slide))
                {
                    m_position.setLocalY(a_collider.getPosition().getGlobalY());
                    m_nextPosition.Y = m_position.getGlobalY();
                    m_speed.Y = 0;
                    m_speed.X = 0;
                    m_currentState = State.Hanging;
                    m_facingRight = false;
                    m_hangSound.play();
                }
            }
        }