Added Node camera transitions
Fixed Conveyor speedup issue
This commit is contained in:
21
Assets/Scripts/Network/NetworkCamera.cs
Normal file
21
Assets/Scripts/Network/NetworkCamera.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class NetworkCamera : MonoBehaviour
|
||||
{
|
||||
|
||||
public Vector3 targetPosition;
|
||||
public float lerpSpeed = 2;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
targetPosition = transform.position;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
transform.position = Vector3.Lerp(transform.position, targetPosition, Time.deltaTime * lerpSpeed);
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Network/NetworkCamera.cs.meta
Normal file
11
Assets/Scripts/Network/NetworkCamera.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 364c461b2fc6fda47a92951a29c3ffa6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -27,9 +27,16 @@ public class Node : MonoBehaviour
|
||||
{
|
||||
if (isActive) { return; }
|
||||
Debug.Log(string.Format("{0} became active node", gameObject.name));
|
||||
isActive = true;
|
||||
UI.SetActive(true);
|
||||
gameManager.networkCamera.transform.position = new Vector3(transform.position.x, gameManager.networkCamera.transform.position.y, transform.position.z);
|
||||
gameManager.activeNode = this.gameObject;
|
||||
gameManager.networkCamera.GetComponent<NetworkCamera>().targetPosition = new Vector3(transform.position.x, gameManager.networkCamera.transform.position.y, transform.position.z);
|
||||
isActive = true;
|
||||
}
|
||||
|
||||
public void DisableNode()
|
||||
{
|
||||
UI.SetActive(false);
|
||||
isActive = false;
|
||||
}
|
||||
|
||||
public void MoveToDirection(Direction dir)
|
||||
@@ -38,8 +45,7 @@ public class Node : MonoBehaviour
|
||||
if (nodeComp)
|
||||
{
|
||||
nodeComp.SetActiveNode();
|
||||
UI.SetActive(false);
|
||||
isActive = false;
|
||||
DisableNode();
|
||||
} else
|
||||
{
|
||||
connections[(int)dir].SendMessage("InteractNode");
|
||||
|
||||
@@ -30,7 +30,7 @@ public class Switch : MonoBehaviour
|
||||
{
|
||||
if (Vector3.Distance(transform.position, gameManager.player.transform.position) < interactionDistance) {
|
||||
//Debug.Log("Switch is visible and in range");
|
||||
if (Keyboard.current.eKey.wasPressedThisFrame)
|
||||
if (Keyboard.current.eKey.wasPressedThisFrame && !gameManager.activeNode)
|
||||
{
|
||||
gameManager.SetActiveCamera(1);
|
||||
debugNode.SendMessage("SetActiveNode", debugNode.GetComponent<Node>());
|
||||
|
||||
Reference in New Issue
Block a user