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; BoxCollider2D col; SpriteRenderer rend; void Start() { col = GetComponent(); rend = GetComponent(); if (inFirstDim) { col.enabled = true; rend.enabled = true; } else { col.enabled = false; rend.enabled = false; } } void Update() { if (Input.GetKeyDown(KeyCode.LeftShift)&&inFirstDim) { col.enabled = false; rend.enabled = false; inFirstDim = !inFirstDim; } else { if (Input.GetKeyDown(KeyCode.LeftShift)&&!inFirstDim) { col.enabled = true; rend.enabled = true; inFirstDim = !inFirstDim; } } } }