Added new Scenes and gave em an order
This commit is contained in:
@@ -11,8 +11,9 @@ public GameObject movingPoint;
|
||||
public Vector3 activatedPointPosition;
|
||||
private Vector3 originalPointPosition;
|
||||
public bool einsAn = false;
|
||||
public bool zweiAn = false;
|
||||
public bool dreiAn = false;
|
||||
public GameObject _LevelManager1;
|
||||
private keyWhenPressed script1;
|
||||
bool isActivated;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
@@ -23,6 +24,11 @@ public bool dreiAn = false;
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
script1 = _LevelManager1.GetComponent<keyWhenPressed>();
|
||||
isActivated = script1.isActivated;
|
||||
if (isActivated){
|
||||
spriteRenderer.sprite = activatedSprite;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,7 +44,8 @@ void OnTriggerExit2D(Collider2D other) {
|
||||
if (other.CompareTag("PressurePlatable")|| other.CompareTag("PlayerIsOnIt")) {
|
||||
spriteRenderer.sprite = originalSprite;
|
||||
movingPoint.transform.position = originalPointPosition;
|
||||
einsAn = false;
|
||||
einsAn = false;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
26
Assets/AssetsFORELLE/Script/DeleteObject.cs
Normal file
26
Assets/AssetsFORELLE/Script/DeleteObject.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DeleteObject : MonoBehaviour
|
||||
{
|
||||
|
||||
public GameObject objectToActivate;
|
||||
public GameObject objectToActivate2;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
objectToActivate.SetActive(true);
|
||||
objectToActivate2.SetActive(true);
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
public void done(){
|
||||
objectToActivate.SetActive(false);
|
||||
objectToActivate2.SetActive(false);
|
||||
}
|
||||
}
|
11
Assets/AssetsFORELLE/Script/DeleteObject.cs.meta
generated
Normal file
11
Assets/AssetsFORELLE/Script/DeleteObject.cs.meta
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c51c7044862333d409c2fee2b1c5c0b8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -14,6 +14,8 @@ public class DimShift : MonoBehaviour
|
||||
AudioLowPassFilter lpf;
|
||||
GameObject Dim1;
|
||||
GameObject Dim2;
|
||||
//remove if unwanted
|
||||
private Animator animator;
|
||||
|
||||
void Start()
|
||||
{
|
||||
@@ -22,6 +24,8 @@ public class DimShift : MonoBehaviour
|
||||
Audio1 = GameObject.Find("AudioController").GetComponent<AudioSource>();
|
||||
Rev1 = GameObject.Find("AudioController").GetComponent<AudioReverbFilter>();
|
||||
lpf = GameObject.Find("AudioController").GetComponent<AudioLowPassFilter>();
|
||||
//remove if unwanted
|
||||
animator = GetComponent<Animator>();
|
||||
|
||||
if (inFirstDim)
|
||||
{
|
||||
@@ -44,6 +48,8 @@ public class DimShift : MonoBehaviour
|
||||
Dim1.SetActive(false);
|
||||
MusicDim2();
|
||||
inFirstDim = !inFirstDim;
|
||||
//remove if unwanted
|
||||
animator.SetTrigger("ShiftsDim");
|
||||
} else
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.LeftShift)&&!inFirstDim)
|
||||
@@ -52,6 +58,8 @@ public class DimShift : MonoBehaviour
|
||||
Dim2.SetActive(false);
|
||||
MusicDim1();
|
||||
inFirstDim = !inFirstDim;
|
||||
//remove if unwanted
|
||||
animator.SetTrigger("ShiftsDim");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
35
Assets/AssetsFORELLE/Script/FallingDetection.cs
Normal file
35
Assets/AssetsFORELLE/Script/FallingDetection.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class FallingDetection : MonoBehaviour
|
||||
{
|
||||
public GameObject _LevelManager1;
|
||||
private CharController script1;
|
||||
bool grounded;
|
||||
private Rigidbody2D playerRigidbody;
|
||||
public bool isFalling;
|
||||
private Animator animator;
|
||||
public int counter = 0;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
animator = GetComponent<Animator>();
|
||||
playerRigidbody = GetComponent<Rigidbody2D>();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
script1 = _LevelManager1.GetComponent<CharController>();
|
||||
grounded= script1.grounded;
|
||||
Vector3 velocity = playerRigidbody.velocity;
|
||||
if (!grounded && velocity.y < -0.1f){
|
||||
if(counter++>90||isFalling){
|
||||
isFalling = true;
|
||||
animator.SetBool("IsFalling", true);
|
||||
counter = 0;}
|
||||
} else {
|
||||
isFalling = false;
|
||||
counter = 0;
|
||||
animator.SetBool("IsFalling", false);}
|
||||
}
|
||||
|
||||
}
|
11
Assets/AssetsFORELLE/Script/FallingDetection.cs.meta
generated
Normal file
11
Assets/AssetsFORELLE/Script/FallingDetection.cs.meta
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4ea2b46765b2a94c81f15618d3ea519
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -5,23 +5,30 @@ using UnityEngine;
|
||||
public class keyWhenPressed : MonoBehaviour
|
||||
{
|
||||
public GameObject objectToActivate;
|
||||
public ButtonDOne ButtonDOne;
|
||||
public ButtonDOne ButtonDTwo;
|
||||
public ButtonDOne ButtonDThree;
|
||||
public GameObject _LevelManager1;
|
||||
private ButtonDOne script1;
|
||||
public GameObject _LevelManager2;
|
||||
private ButtonDTwo script2;
|
||||
public GameObject _LevelManager3;
|
||||
private ButtonDThree script3;
|
||||
|
||||
private bool isActivated;
|
||||
public bool isActivated;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
// Disable the object by default
|
||||
objectToActivate.SetActive(false);
|
||||
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
bool eins = ButtonDOne.einsAn;
|
||||
bool zwei = ButtonDTwo.zweiAn;
|
||||
bool drei = ButtonDThree.dreiAn;
|
||||
script1 = _LevelManager1.GetComponent<ButtonDOne>();
|
||||
script2= _LevelManager2.GetComponent<ButtonDTwo>();
|
||||
script3 = _LevelManager3.GetComponent<ButtonDThree>();
|
||||
bool eins = script1.einsAn;
|
||||
bool zwei = script2.zweiAn;
|
||||
bool drei = script3.dreiAn;
|
||||
// Check if all three conditions are true and the object is not yet activated
|
||||
if (eins && zwei && drei && !isActivated)
|
||||
{
|
||||
|
Reference in New Issue
Block a user