Finalized for game jam submission
Lots of bugfixes New tasks
This commit is contained in:
@@ -11,6 +11,8 @@ public class Node : MonoBehaviour
|
||||
public GameObject[] connections;
|
||||
public GameObject UI;
|
||||
|
||||
public bool isUnlocked = true;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@@ -20,7 +22,10 @@ public class Node : MonoBehaviour
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
if(!isUnlocked)
|
||||
{
|
||||
DisableNode();
|
||||
}
|
||||
}
|
||||
|
||||
public void SetActiveNode()
|
||||
|
||||
@@ -9,8 +9,30 @@ public class NodeButton : MonoBehaviour
|
||||
public Node.Direction direction;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (node.connections[(int)direction] == null)
|
||||
{
|
||||
gameObject.GetComponent<Renderer>().material.color = Color.gray;
|
||||
gameObject.GetComponent<Collider>().enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
//Connected devices have no Node
|
||||
if(node.connections[(int)direction].GetComponent<Node>() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (node.connections[(int)direction].GetComponent<Node>().isUnlocked)
|
||||
{
|
||||
gameObject.GetComponent<Renderer>().material.color = Color.green;
|
||||
gameObject.GetComponent<Collider>().enabled = true;
|
||||
} else
|
||||
{
|
||||
gameObject.GetComponent<Renderer>().material.color = Color.gray;
|
||||
gameObject.GetComponent<Collider>().enabled = false;
|
||||
|
||||
@@ -6,7 +6,6 @@ using UnityEngine.InputSystem;
|
||||
public class Switch : MonoBehaviour
|
||||
{
|
||||
public GameManager gameManager;
|
||||
public float interactionDistance = 10;
|
||||
private Renderer renderer;
|
||||
|
||||
public Node debugNode;
|
||||
@@ -14,7 +13,7 @@ public class Switch : MonoBehaviour
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
renderer = gameObject.GetComponent<Renderer>();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -26,21 +25,21 @@ public class Switch : MonoBehaviour
|
||||
|
||||
|
||||
|
||||
if (renderer.isVisible)
|
||||
{
|
||||
if (Vector3.Distance(transform.position, gameManager.player.transform.position) < interactionDistance) {
|
||||
//Debug.Log("Switch is visible and in range");
|
||||
if (Keyboard.current.eKey.wasPressedThisFrame && !gameManager.activeNode)
|
||||
{
|
||||
gameManager.previousNode = debugNode;
|
||||
gameManager.activeNode = debugNode.gameObject;
|
||||
gameManager.SetActiveCamera(gameManager.networkCamera);
|
||||
debugNode.SendMessage("SetActiveNode", debugNode.GetComponent<Node>());
|
||||
gameManager.player.GetComponent<StarterAssets.FirstPersonController>().enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void PlayerInteract()
|
||||
{
|
||||
if(!gameManager.activeNode)
|
||||
{
|
||||
gameManager.previousNode = debugNode;
|
||||
gameManager.activeNode = debugNode.gameObject;
|
||||
gameManager.SetActiveCamera(gameManager.networkCamera);
|
||||
debugNode.SendMessage("SetActiveNode", debugNode.GetComponent<Node>());
|
||||
gameManager.player.GetComponent<StarterAssets.FirstPersonController>().enabled = false;
|
||||
Cursor.lockState = CursorLockMode.Confined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user