예제 #1
0
    private void OnMapChangeListener()
    {
        var agentGridPos = GridHelper.GetGridPosFromWorldPoint(transform.position);

        if (!_terrainInfo.IsValidGrisPosition(agentGridPos))
        {
            transform.position = Vector3.zero;
        }
    }
예제 #2
0
 void Update()
 {
     if (Input.GetMouseButtonDown(0))
     {
         var gridPos = GridHelper.GetGridPosFromScreenPoint(Input.mousePosition);
         if (_terrainInfo.IsValidGrisPosition(gridPos))
         {
             if (_terrainInfo.IsWall(gridPos))
             {
                 _terrainInfo.RemoveWall(gridPos);
             }
             else
             {
                 _terrainInfo.SetWall(gridPos);
             }
         }
     }
 }
예제 #3
0
    //public TileBehavior GetTileAt(int col, int row)
    //{
    //    Debug.Assert(_terrainInfo.IsValidGrisPosition(col, row), "Out of bounds", this);

    //    return _tiles[col, row];
    //}

    public void SetTileColor(Vector2Int pos, Color color)
    {
        Debug.Assert(_terrainInfo.IsValidGrisPosition(pos), "Out of bounds", this);

        _tiles[pos.x, pos.y].SetColor(color);
    }