Skip to content

Commit

Permalink
botoes interactable corrigidos
Browse files Browse the repository at this point in the history
  • Loading branch information
Feliperpvieira committed Sep 8, 2022
1 parent 2eb4b31 commit 99d6152
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 29 deletions.
29 changes: 15 additions & 14 deletions RePraça/Assets/Prefabs/Banco.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ GameObject:
- component: {fileID: 7772229598687345955}
- component: {fileID: 5492270510095583721}
- component: {fileID: 8242443261884649718}
- component: {fileID: 3786076108369305517}
- component: {fileID: 5848181851528521051}
- component: {fileID: 5024561761801153371}
m_Layer: 0
m_Name: Banco
m_TagString: Objetos
Expand Down Expand Up @@ -103,19 +103,6 @@ Rigidbody:
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!65 &3786076108369305517
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6284925690302588988}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.013401608, y: 0.005016182, z: 0.0033442513}
m_Center: {x: 0.0000054491684, y: 0.002208091, z: 9.313226e-10}
--- !u!114 &5848181851528521051
MonoBehaviour:
m_ObjectHideFlags: 0
Expand All @@ -128,3 +115,17 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 66f930315bdaa44758cc4e86574d0944, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!64 &5024561761801153371
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6284925690302588988}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 4
m_Convex: 1
m_CookingOptions: 30
m_Mesh: {fileID: -1550514412580984892, guid: 425e88c6d10c4479ab886bcba5240c83, type: 3}
2 changes: 0 additions & 2 deletions RePraça/Assets/Scripts/BuildingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ void Update()
if(pendingObject != null) //checa se existe um objeto selecionado
{
painelBtnObjetos.interactable = false; //desativa os botões de adicionar objetos
selectionManager.editObjSelect.interactable = true; //desativa os botoes de girar e posicionar

UpdateMaterials(); //atualiza a cor pra definir se pode ou nao colocar lá

Expand Down Expand Up @@ -67,7 +66,6 @@ void Update()
else if(pendingObject == null)
{
painelBtnObjetos.interactable = true; //reativa os botoes pra adicionar objetos
selectionManager.editObjSelect.interactable = false; //reativa os botoes de girar e posicionar
}
}

Expand Down
28 changes: 15 additions & 13 deletions RePraça/Assets/Scripts/SelectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,23 @@ void Update()
}
}

if (Input.GetMouseButtonDown(1) && selectedObject != null)
if (Input.GetKeyDown(KeyCode.Escape) && selectedObject != null)
{
Deselect();
}

if (buildingManager.pendingObject == null) //ativa os botões pra mover e deselecionar quando o objeto não estiver sendo movido
{
botaoMoverObj.interactable = true;
deselectObj.interactable = true;
editObjSelect.interactable = false; //desativa os botoes de girar e posicionar
}
else if (buildingManager.pendingObject != null)
{
botaoMoverObj.interactable = false;
deselectObj.interactable = false;
editObjSelect.interactable = true; //reativa os botoes de girar e posicionar
}
}

public void Select(GameObject obj)
Expand All @@ -78,14 +91,7 @@ public void Select(GameObject obj)
objNameText.text = obj.name; //coloca o nome do objeto selecionado no campo de texto do nome da interface
objSelectUI.SetActive(true); //faz o pop-up de seleção de objeto aparecer

selectedObject = obj; //iguala a variavel de objeto selecionado ao obj da função select

if(buildingManager.pendingObject == null) //ativa os botões pra mover e deselecionar quando o objeto não estiver sendo movido
{
botaoMoverObj.interactable = true;
deselectObj.interactable = true;
}

selectedObject = obj; //iguala a variavel de objeto selecionado ao obj da função select
}

public void Deselect()
Expand All @@ -99,10 +105,6 @@ public void Deselect()
public void Move()
{
buildingManager.pendingObject = selectedObject;

//desativa os botões de mover e deselecionar quando o objeto estiver se movendo
botaoMoverObj.interactable = false;
deselectObj.interactable = false;
}

public void Delete()
Expand Down

0 comments on commit 99d6152

Please sign in to comment.