예제 #1
0
    void Move()
    {
        int iCheckCol = m_Char.m_iCol;
        int iCheckRow = m_Char.m_iRow;

        switch (m_Direction)
        {
        case EDirection.left:
            iCheckCol -= 1;
            break;

        case EDirection.right:
            iCheckCol += 1;
            break;

        case EDirection.up:
            iCheckRow += 1;
            break;

        case EDirection.down:
            iCheckRow -= 1;
            break;
        }

        square checkSquare = m_Char.m_Board.GetSquare(iCheckCol, iCheckRow);

        // walkable
        if (checkSquare != null && checkSquare.GetAlive() == false)
        {
            m_Char.Move(m_Direction);
        }
        // not walkable
        else
        {
            m_Direction = Foo.GetLeft(m_Direction);
        }
    }
예제 #2
0
    public bool IsWalkable(int _iCol, int _iRow)
    {
        square Square = GetSquare(_iCol, _iRow);

        return(Square != null && Square.GetAlive() == false);
    }