Exemplo n.º 1
0
    void Moving(Tile _nextTile)
    {
        if (CheckCanMove() == false)
        {
            return;
        }
        if (Attack() == true)
        {
            return;
        }
        if (_nextTile.Contains <Wall>() != null)
        {
            _nextTile.Contains <Wall>().GetComponent <Wall>().Dig(1);
            return;
        }
        if (_nextTile.Contains <Gold>() != null)
        {
            m_Inventory.PickGold(_nextTile.Contains <Gold>());
        }
        m_OldTile = m_CurrentTile;
        m_CurrentTile.RemoveFromTile(GetComponent <AboveTileObject>());
        m_CurrentTile = _nextTile;
        m_CurrentTile.AddToTile(GetComponent <AboveTileObject>());
        Vector3 new_position = m_CurrentTile.transform.position;

        m_NewPosition    = new Vector3(new_position.x, new_position.y, m_CurrentTile.GetLayerNumber());
        m_MovementStatus = MOVEMENT_STATUS.MovingAnimation;
        UpdatePlayerDirection();

        NotifySubscribers();
    }