49 lines
1.1 KiB
C#
Raw Normal View History

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// Kann sein das das nur für statische Objekte funktioniert
public class DimShift : MonoBehaviour
{
// 0 = inactive in Dimension 1
// 1 = active in Dimension 1
public bool inFirstDim;
GameObject Dim1;
GameObject Dim2;
void Start()
{
Dim1 = GameObject.Find("Dim1");
Dim2 = GameObject.Find("Dim2");
if (inFirstDim)
{
Dim1.SetActive(true);
Dim2.SetActive(false);
} else
{
Dim2.SetActive(true);
Dim1.SetActive(false);
}
}
void Update()
{
if (Input.GetKeyDown(KeyCode.LeftShift)&&inFirstDim)
{
Dim2.SetActive(true);
Dim1.SetActive(false);
inFirstDim = !inFirstDim;
} else
{
if (Input.GetKeyDown(KeyCode.LeftShift)&&!inFirstDim)
{
Dim1.SetActive(true);
Dim2.SetActive(false);
inFirstDim = !inFirstDim;
}
}
}
}