Buttons und Button der nur Spieler mit Box dabei nimmt sind drin, ausserdem rudimentäre Tür die dann verschwindet

This commit is contained in:
Dominik 2023-05-16 18:12:04 +02:00
parent b8ae715f05
commit 5ab26a5096
16 changed files with 2134 additions and 2 deletions

View File

@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ButtonBoth:MonoBehaviour
{
public GameObject door;
public SpriteRenderer spriteRenderer;
public Sprite originalSprite;
public Sprite activatedSprite;
public bool startActivated = false;
private Collider2D Stein = null;
// 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;
openDoor();
}
}
void OnTriggerEnter2D(Collider2D other) {
Stein = other;
if (other.CompareTag("PlayerIsOnIt")) {
startActivated = true;
spriteRenderer.sprite = activatedSprite;
openDoor();
}
}
void openDoor(){
door.SetActive(false);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2dc9b878c80754a479afe39d30c684de
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ButtonObj:MonoBehaviour
{
public SpriteRenderer spriteRenderer;
public Sprite originalSprite;
public Sprite activatedSprite;
public bool startActivated = 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;}
}
void OnTriggerEnter2D(Collider2D other) {
if (other.CompareTag("PressurePlatable")|| other.CompareTag("PlayerIsOnIt")) {
startActivated = true;
spriteRenderer.sprite = activatedSprite;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ce077c3c105211642bd53a5866b50b4d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ButtonPlayer:MonoBehaviour
{
public SpriteRenderer spriteRenderer;
public Sprite originalSprite;
public Sprite activatedSprite;
public bool startActivated = 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;}
}
void OnTriggerEnter2D(Collider2D other) {
if (other.CompareTag("Player")) {
spriteRenderer.sprite = activatedSprite;
startActivated = true;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bc263b7f4d037fc4187b6b8fc095cb15
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class IsPlayerOnTop:MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
void OnTriggerEnter2D(Collider2D other) {
if (other.CompareTag("Player")) {
gameObject.tag = "PlayerIsOnIt";
}
}
void OnTriggerExit2D(Collider2D other) {
if (other.CompareTag("Player")) {
gameObject.tag = "PressurePlatable";
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1a9bf412d91f64d47b4e4be6ff9f4f5e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -20,13 +20,13 @@ public Sprite activatedSprite;
}
void OnTriggerEnter2D(Collider2D other) {
if (other.CompareTag("PressurePlatable")) {
if (other.CompareTag("PressurePlatable") || other.CompareTag("PlayerIsOnIt")){
spriteRenderer.sprite = activatedSprite;
}
}
void OnTriggerExit2D(Collider2D other) {
if (other.CompareTag("PressurePlatable")) {
if (other.CompareTag("PressurePlatable")|| other.CompareTag("PlayerIsOnIt")) {
spriteRenderer.sprite = originalSprite;
}
}

View File

@ -41,6 +41,8 @@ MonoBehaviour:
instantiationMode: 0
- dependency: {fileID: 2800000, guid: 194aedcc234be71428a25e32d62ccd9d, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: bc1e36585ebd79d4db8ca18c1637587d, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: f0562aa725f59684cbbf4dac90ab7aae, type: 3}

View File

@ -665,6 +665,90 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &517000622
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 517000624}
- component: {fileID: 517000623}
m_Layer: 0
m_Name: RespawnPoint
m_TagString: Untagged
m_Icon: {fileID: -5487077368411116049, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!212 &517000623
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 517000622}
m_Enabled: 0
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 1, y: 1}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!4 &517000624
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 517000622}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -9.28, y: -3.03, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &593477712
GameObject:
m_ObjectHideFlags: 0

View File

@ -0,0 +1,62 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 13966, guid: 0000000000000000e000000000000000, type: 0}
m_Name: ButtonTypes
m_EditorClassIdentifier:
templateScene: {fileID: 102900000, guid: be7389b5b7da44b47b6de41f66253458, type: 3}
templateName:
description:
preview: {fileID: 0}
dependencies:
- dependency: {fileID: 2800000, guid: 309b1d5a294fd6c43ae9cf77656c1852, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: 0ccc508108fa6ed4fa11b4a467d7f609, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: 3a7e66d5a44a93a4c92b1ec5adbbbab9, type: 3}
instantiationMode: 0
- dependency: {fileID: 6200000, guid: 9a162dcdc92b4194ba53630f8785bed1, type: 2}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: 0c6a2a64ca9f9c946a7dbbd1674cf5bd, type: 3}
instantiationMode: 0
- dependency: {fileID: 7400000, guid: a365ad615f8e3174d8ba7f9026c65cb7, type: 2}
instantiationMode: 0
- dependency: {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: b4fab302387dd5a4e8c59120fb28f06c, type: 3}
instantiationMode: 0
- dependency: {fileID: 7400000, guid: e5863731ec9142e4988081d88f0fa545, type: 2}
instantiationMode: 0
- dependency: {fileID: 9100000, guid: 44043e1d2a4d940438b0fdfee3f92bb0, type: 2}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: d393166e35af62140af2d003436dba4f, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: 194aedcc234be71428a25e32d62ccd9d, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: 748ae8b33df036b46a86e0387f1602cf, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: bc1e36585ebd79d4db8ca18c1637587d, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: f0562aa725f59684cbbf4dac90ab7aae, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: 616c5890bd1a44340b72cd4c9f3befc2, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: ac4f690e99db5bb43bedb920eda2f7c5, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: 5679a74364f6b4440ab7e7aed55cd95e, type: 3}
instantiationMode: 0
- dependency: {fileID: 2800000, guid: 23e66f7264c74424889342127f229577, type: 3}
instantiationMode: 0
templatePipeline: {fileID: 0}
badge: {fileID: 0}
addToDefaults: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 34e0fa8f7a7af174f9ef698f680db59f
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

1773
Assets/Scenes/ButtonTypes.unity generated Normal file

File diff suppressed because it is too large Load Diff

7
Assets/Scenes/ButtonTypes.unity.meta generated Normal file
View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: be7389b5b7da44b47b6de41f66253458
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -5,6 +5,7 @@ TagManager:
serializedVersion: 2
tags:
- PressurePlatable
- PlayerIsOnIt
layers:
- Default
- TransparentFX