early prototype D level
This commit is contained in:
parent
9e9c85a51e
commit
21a1bae027
42
Assets/AssetsFORELLE/Script/ButtonDOne.cs
Normal file
42
Assets/AssetsFORELLE/Script/ButtonDOne.cs
Normal file
@ -0,0 +1,42 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ButtonDOne: MonoBehaviour
|
||||
{
|
||||
public SpriteRenderer spriteRenderer;
|
||||
public Sprite originalSprite;
|
||||
public Sprite activatedSprite;
|
||||
public GameObject movingPoint;
|
||||
public Vector3 activatedPointPosition;
|
||||
private Vector3 originalPointPosition;
|
||||
public bool einsAn = false;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
originalPointPosition = movingPoint.transform.position;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D other) {
|
||||
if (other.CompareTag("PressurePlatable") || other.CompareTag("PlayerIsOnIt")){
|
||||
spriteRenderer.sprite = activatedSprite;
|
||||
movingPoint.transform.position = activatedPointPosition;
|
||||
einsAn = true;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerExit2D(Collider2D other) {
|
||||
if (other.CompareTag("PressurePlatable")|| other.CompareTag("PlayerIsOnIt")) {
|
||||
spriteRenderer.sprite = originalSprite;
|
||||
movingPoint.transform.position = originalPointPosition;
|
||||
einsAn = false;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/AssetsFORELLE/Script/ButtonDOne.cs.meta
generated
Normal file
11
Assets/AssetsFORELLE/Script/ButtonDOne.cs.meta
generated
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a711d58f4fee574b918e2c7c924722e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
51
Assets/AssetsFORELLE/Script/ButtonDThree.cs
Normal file
51
Assets/AssetsFORELLE/Script/ButtonDThree.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ButtonDThree:MonoBehaviour
|
||||
{
|
||||
|
||||
public SpriteRenderer spriteRenderer;
|
||||
public Sprite originalSprite;
|
||||
public Sprite activatedSprite;
|
||||
public bool startActivated = false;
|
||||
private Collider2D Stein = null;
|
||||
public bool dreiAn = false;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (startActivated == true ) {
|
||||
spriteRenderer.sprite = activatedSprite;
|
||||
} else {
|
||||
spriteRenderer.sprite = originalSprite;}
|
||||
|
||||
if(Stein!=null && Stein.CompareTag("PlayerIsOnIt")){
|
||||
startActivated = true;
|
||||
spriteRenderer.sprite = activatedSprite;
|
||||
dreiAn = true;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D other) {
|
||||
Stein = other;
|
||||
if (other.CompareTag("PressurePlatable")||other.CompareTag("Player")) {
|
||||
startActivated = true;
|
||||
spriteRenderer.sprite = activatedSprite;
|
||||
dreiAn = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
11
Assets/AssetsFORELLE/Script/ButtonDThree.cs.meta
generated
Normal file
11
Assets/AssetsFORELLE/Script/ButtonDThree.cs.meta
generated
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e28dfd33df66e4047a79bdf79a599a79
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
51
Assets/AssetsFORELLE/Script/ButtonDTwo.cs
Normal file
51
Assets/AssetsFORELLE/Script/ButtonDTwo.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ButtonDTwo:MonoBehaviour
|
||||
{
|
||||
|
||||
public SpriteRenderer spriteRenderer;
|
||||
public Sprite originalSprite;
|
||||
public Sprite activatedSprite;
|
||||
public bool startActivated = false;
|
||||
private Collider2D Stein = null;
|
||||
public bool zweiAn = false;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
if (startActivated == true ) {
|
||||
spriteRenderer.sprite = activatedSprite;
|
||||
} else {
|
||||
spriteRenderer.sprite = originalSprite;}
|
||||
|
||||
if(Stein!=null && Stein.CompareTag("PlayerIsOnIt")){
|
||||
startActivated = true;
|
||||
spriteRenderer.sprite = activatedSprite;
|
||||
zweiAn = true;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerEnter2D(Collider2D other) {
|
||||
Stein = other;
|
||||
if (other.CompareTag("PressurePlatable")||other.CompareTag("Player")) {
|
||||
startActivated = true;
|
||||
spriteRenderer.sprite = activatedSprite;
|
||||
zweiAn = true;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
11
Assets/AssetsFORELLE/Script/ButtonDTwo.cs.meta
generated
Normal file
11
Assets/AssetsFORELLE/Script/ButtonDTwo.cs.meta
generated
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 06a77ec31d8a8c241a9551c90c41d8b4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
33
Assets/AssetsFORELLE/Script/keyWhenPressed.cs
Normal file
33
Assets/AssetsFORELLE/Script/keyWhenPressed.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class keyWhenPressed : MonoBehaviour
|
||||
{
|
||||
public GameObject objectToActivate;
|
||||
public ButtonDOne ButtonDOne;
|
||||
public ButtonDOne ButtonDTwo;
|
||||
public ButtonDOne ButtonDThree;
|
||||
|
||||
private 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;
|
||||
// Check if all three conditions are true and the object is not yet activated
|
||||
if (eins && zwei && drei && !isActivated)
|
||||
{
|
||||
// Activate the object
|
||||
objectToActivate.SetActive(true);
|
||||
isActivated = true;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/AssetsFORELLE/Script/keyWhenPressed.cs.meta
generated
Normal file
11
Assets/AssetsFORELLE/Script/keyWhenPressed.cs.meta
generated
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a34f045dbf0a2d4cb2643f68a81acb7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
7365
Assets/Scenes/DScene.unity
generated
Normal file
7365
Assets/Scenes/DScene.unity
generated
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/DScene.unity.meta
generated
Normal file
7
Assets/Scenes/DScene.unity.meta
generated
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 869778d3bc3ffd7489e9ad73ceaae1e9
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
x
Reference in New Issue
Block a user