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