Fixed GUI not closing properly based on distance from objects leaving mouse cursor enabled.
This commit is contained in:
parent
46b5ac977c
commit
93e7550e8b
@ -16,6 +16,7 @@ public class BlockInteraction
|
|||||||
//! Called once per frame when the player is looking at an iron block.
|
//! Called once per frame when the player is looking at an iron block.
|
||||||
public void InteractWithIronBlock()
|
public void InteractWithIronBlock()
|
||||||
{
|
{
|
||||||
|
playerController.machineGUIopen = false;
|
||||||
if (cInput.GetKeyDown("Collect Object"))
|
if (cInput.GetKeyDown("Collect Object"))
|
||||||
{
|
{
|
||||||
string objectName = "";
|
string objectName = "";
|
||||||
@ -36,6 +37,7 @@ public class BlockInteraction
|
|||||||
//! Called once per frame when the player is looking at a steel block.
|
//! Called once per frame when the player is looking at a steel block.
|
||||||
public void InteractWithSteelBlock()
|
public void InteractWithSteelBlock()
|
||||||
{
|
{
|
||||||
|
playerController.machineGUIopen = false;
|
||||||
if (cInput.GetKeyDown("Collect Object"))
|
if (cInput.GetKeyDown("Collect Object"))
|
||||||
{
|
{
|
||||||
string objectName = "";
|
string objectName = "";
|
||||||
@ -55,6 +57,7 @@ public class BlockInteraction
|
|||||||
//! Called once per frame when the player is looking at a glass block.
|
//! Called once per frame when the player is looking at a glass block.
|
||||||
public void InteractWithGlass()
|
public void InteractWithGlass()
|
||||||
{
|
{
|
||||||
|
playerController.machineGUIopen = false;
|
||||||
if (cInput.GetKeyDown("Collect Object"))
|
if (cInput.GetKeyDown("Collect Object"))
|
||||||
{
|
{
|
||||||
interactionController.CollectObject("Glass Block");
|
interactionController.CollectObject("Glass Block");
|
||||||
@ -64,6 +67,7 @@ public class BlockInteraction
|
|||||||
//! Called once per frame when the player is looking at a brick block.
|
//! Called once per frame when the player is looking at a brick block.
|
||||||
public void InteractWithBricks()
|
public void InteractWithBricks()
|
||||||
{
|
{
|
||||||
|
playerController.machineGUIopen = false;
|
||||||
if (cInput.GetKeyDown("Collect Object"))
|
if (cInput.GetKeyDown("Collect Object"))
|
||||||
{
|
{
|
||||||
interactionController.CollectObject("Brick");
|
interactionController.CollectObject("Brick");
|
||||||
@ -73,6 +77,7 @@ public class BlockInteraction
|
|||||||
//! Called once per frame when the player is looking at a combined mesh object.
|
//! Called once per frame when the player is looking at a combined mesh object.
|
||||||
public void InteractWithCombinedMesh()
|
public void InteractWithCombinedMesh()
|
||||||
{
|
{
|
||||||
|
playerController.machineGUIopen = false;
|
||||||
playerController.lookingAtCombinedMesh = true;
|
playerController.lookingAtCombinedMesh = true;
|
||||||
if (cInput.GetKeyDown("Collect Object") && playerController.paintGunActive == false)
|
if (cInput.GetKeyDown("Collect Object") && playerController.paintGunActive == false)
|
||||||
{
|
{
|
||||||
@ -119,6 +124,7 @@ public class BlockInteraction
|
|||||||
|
|
||||||
private IEnumerator PaintMesh(GameObject[] holders, string name)
|
private IEnumerator PaintMesh(GameObject[] holders, string name)
|
||||||
{
|
{
|
||||||
|
playerController.machineGUIopen = false;
|
||||||
BlockDictionary blockDictionary = new BlockDictionary(playerController);
|
BlockDictionary blockDictionary = new BlockDictionary(playerController);
|
||||||
Color color = new Color(playerController.paintRed, playerController.paintGreen, playerController.paintBlue);
|
Color color = new Color(playerController.paintRed, playerController.paintGreen, playerController.paintBlue);
|
||||||
foreach (GameObject holder in holders)
|
foreach (GameObject holder in holders)
|
||||||
|
@ -154,6 +154,10 @@ public class InteractionController : MonoBehaviour
|
|||||||
{
|
{
|
||||||
playerController.objectInSight = obj;
|
playerController.objectInSight = obj;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EndInteraction();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -217,7 +221,7 @@ public class InteractionController : MonoBehaviour
|
|||||||
}
|
}
|
||||||
|
|
||||||
//! Opens the machine GUI.
|
//! Opens the machine GUI.
|
||||||
public void OpenMachineGUI()
|
public void ToggleMachineGUI()
|
||||||
{
|
{
|
||||||
if (playerController.machineGUIopen == false)
|
if (playerController.machineGUIopen == false)
|
||||||
{
|
{
|
||||||
@ -259,11 +263,8 @@ public class InteractionController : MonoBehaviour
|
|||||||
|
|
||||||
//! Called when the player is no longer looking at any interactive objects.
|
//! Called when the player is no longer looking at any interactive objects.
|
||||||
private void EndInteraction()
|
private void EndInteraction()
|
||||||
{
|
|
||||||
if (playerController.machineGUIopen == true)
|
|
||||||
{
|
{
|
||||||
playerController.machineGUIopen = false;
|
playerController.machineGUIopen = false;
|
||||||
}
|
|
||||||
playerController.lookingAtCombinedMesh = false;
|
playerController.lookingAtCombinedMesh = false;
|
||||||
playerController.objectInSight = null;
|
playerController.objectInSight = null;
|
||||||
playerController.machineInSight = null;
|
playerController.machineInSight = null;
|
||||||
|
@ -100,7 +100,7 @@ public class MachineInteraction
|
|||||||
}
|
}
|
||||||
if (cInput.GetKeyDown("Interact"))
|
if (cInput.GetKeyDown("Interact"))
|
||||||
{
|
{
|
||||||
interactionController.OpenMachineGUI();
|
interactionController.ToggleMachineGUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ public class MachineInteraction
|
|||||||
}
|
}
|
||||||
if (cInput.GetKeyDown("Interact"))
|
if (cInput.GetKeyDown("Interact"))
|
||||||
{
|
{
|
||||||
interactionController.OpenMachineGUI();
|
interactionController.ToggleMachineGUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ public class MachineInteraction
|
|||||||
}
|
}
|
||||||
if (cInput.GetKeyDown("Interact"))
|
if (cInput.GetKeyDown("Interact"))
|
||||||
{
|
{
|
||||||
interactionController.OpenMachineGUI();
|
interactionController.ToggleMachineGUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +181,7 @@ public class MachineInteraction
|
|||||||
}
|
}
|
||||||
if (cInput.GetKeyDown("Interact"))
|
if (cInput.GetKeyDown("Interact"))
|
||||||
{
|
{
|
||||||
interactionController.OpenMachineGUI();
|
interactionController.ToggleMachineGUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ public class MachineInteraction
|
|||||||
}
|
}
|
||||||
if (cInput.GetKeyDown("Interact"))
|
if (cInput.GetKeyDown("Interact"))
|
||||||
{
|
{
|
||||||
interactionController.OpenMachineGUI();
|
interactionController.ToggleMachineGUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,7 +421,7 @@ public class MachineInteraction
|
|||||||
}
|
}
|
||||||
if (cInput.GetKeyDown("Interact"))
|
if (cInput.GetKeyDown("Interact"))
|
||||||
{
|
{
|
||||||
interactionController.OpenMachineGUI();
|
interactionController.ToggleMachineGUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -499,7 +499,7 @@ public class MachineInteraction
|
|||||||
}
|
}
|
||||||
if (cInput.GetKeyDown("Interact"))
|
if (cInput.GetKeyDown("Interact"))
|
||||||
{
|
{
|
||||||
interactionController.OpenMachineGUI();
|
interactionController.ToggleMachineGUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -737,7 +737,7 @@ public class MachineInteraction
|
|||||||
}
|
}
|
||||||
if (cInput.GetKeyDown("Interact"))
|
if (cInput.GetKeyDown("Interact"))
|
||||||
{
|
{
|
||||||
interactionController.OpenMachineGUI();
|
interactionController.ToggleMachineGUI();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -751,6 +751,7 @@ public class PlayerController : MonoBehaviour
|
|||||||
if (distance > 40)
|
if (distance > 40)
|
||||||
{
|
{
|
||||||
storageGUIopen = false;
|
storageGUIopen = false;
|
||||||
|
inventoryOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -759,6 +760,7 @@ public class PlayerController : MonoBehaviour
|
|||||||
if (distance > 40)
|
if (distance > 40)
|
||||||
{
|
{
|
||||||
storageGUIopen = false;
|
storageGUIopen = false;
|
||||||
|
inventoryOpen = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ public class StorageInteraction
|
|||||||
//! Called when the player is looking at a storage container.
|
//! Called when the player is looking at a storage container.
|
||||||
public void InteractWithStorageContainer()
|
public void InteractWithStorageContainer()
|
||||||
{
|
{
|
||||||
|
playerController.machineGUIopen = false;
|
||||||
InventoryManager inventory = playerController.objectInSight.GetComponent<InventoryManager>();
|
InventoryManager inventory = playerController.objectInSight.GetComponent<InventoryManager>();
|
||||||
if (cInput.GetKeyDown("Interact"))
|
if (cInput.GetKeyDown("Interact"))
|
||||||
{
|
{
|
||||||
@ -100,6 +101,7 @@ public class StorageInteraction
|
|||||||
//! Called when the player is looking at a storage computer.
|
//! Called when the player is looking at a storage computer.
|
||||||
public void InteractWithStorageComputer()
|
public void InteractWithStorageComputer()
|
||||||
{
|
{
|
||||||
|
playerController.machineGUIopen = false;
|
||||||
playerController.machineInSight = playerController.objectInSight;
|
playerController.machineInSight = playerController.objectInSight;
|
||||||
StorageComputer computer = playerController.objectInSight.GetComponent<StorageComputer>();
|
StorageComputer computer = playerController.objectInSight.GetComponent<StorageComputer>();
|
||||||
playerController.machineID = computer.ID;
|
playerController.machineID = computer.ID;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user