Revert "Musik Anderswelt & Effekte"

This reverts commit 574b404c2d
This commit is contained in:
Luca Wey
2023-06-07 11:42:40 +02:00
parent 574b404c2d
commit c7940aa8ea
1062 changed files with 181139 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BoulderFix : MonoBehaviour
{
private Rigidbody2D rb;
private BoxCollider2D bc;
[SerializeField] private PhysicsMaterial2D frictionless;
[SerializeField] private PhysicsMaterial2D frictionful;
void Start()
{
rb = GetComponent<Rigidbody2D>();
bc = GetComponent<BoxCollider2D>();
rb.mass = 8;
rb.drag = 1;
}
// Update is called once per frame
void Update()
{
}
void OnCollisionEnter2D(Collision2D col)
{
bc.sharedMaterial = frictionless;
rb.drag = 3;
}
void OnCollisionExit2D(Collision2D col)
{
bc.sharedMaterial = frictionful;
rb.drag = 1;
}
}

View File

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

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,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/*
Static Class which takes role of Controller for all the Cameras/Triggers
IMPORTANT!!!
The Priority of the FIRST Camera that should be shown has to be set manually to 100
The Priorities of the OTHER cameras can be anything else then 100
IMPORTANT!!!
*/
public static class CameraController
{
public static Camera currentCam;
static List<Camera> cameras = new List<Camera>();
public static void Register(Camera cam)
{
cameras.Add(cam);
}
public static void ActivateCamera(Camera cam)
{
cam.depth = 100;
currentCam = cam;
foreach (Camera c in cameras)
{
if(c != currentCam) c.depth = 0;
}
}
public static Camera CurrentCamera()
{
return currentCam;
}
}

View File

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

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class ChangeScene : MonoBehaviour
{
public Scene changeTo;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.CompareTag("SceneChanger"))
{
SceneManager.LoadScene(other.gameObject.name);
}
}
}

View File

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

View File

@@ -0,0 +1,99 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CharController : MonoBehaviour
{
public float maxSpeed = 3.4f;
public float jumpHeight = 6.5f;
public float gravityScale = 1.5f;
public Camera mainCamera;
bool facingRight = true;
public bool grounded = false;
Vector3 cameraPos;
float moveDirection = 0;
Rigidbody2D rb;
CapsuleCollider2D mainCollider;
CapsuleCollider2D friction;
Transform t;
// Start is called before the first frame update
void Start()
{
t = transform;
rb = GetComponent<Rigidbody2D>();
mainCollider = GetComponent<CapsuleCollider2D>();
friction = GetComponent<CapsuleCollider2D>();
rb.freezeRotation = true;
rb.gravityScale = gravityScale;
if(mainCamera)
{
cameraPos = mainCamera.transform.position;
}
}
// Update is called once per frame
void Update()
{
//if(grounded || Mathf.Abs(rb.velocity.x) > 0.01f)
moveDirection = Input.GetAxisRaw("Horizontal");
if(moveDirection != 0)
{
if (moveDirection > 0 && !facingRight)
{
facingRight = true;
t.localScale = new Vector3(Mathf.Abs(t.localScale.x), t.localScale.y, transform.localScale.z);
}
if (moveDirection < 0 && facingRight)
{
facingRight = false;
t.localScale = new Vector3(-Mathf.Abs(t.localScale.x), t.localScale.y, t.localScale.z);
}
}
if(Input.GetButtonDown("Jump") && grounded)
{
rb.velocity = new Vector2(rb.velocity.x, jumpHeight);
}
if (mainCamera)
{
mainCamera.transform.position = new Vector3(t.position.x, t.position.y, cameraPos.z);
}
}
void FixedUpdate()
{
Bounds colliderBounds = mainCollider.bounds;
float colliderRadius = mainCollider.size.x * 0.4f * Mathf.Abs(transform.localScale.x);
Vector3 groundCheckPos = colliderBounds.min + new Vector3(colliderBounds.size.x * 0.5f, colliderRadius * 0.9f, 0);
Collider2D[] colliders = Physics2D.OverlapCircleAll(groundCheckPos, colliderRadius);
grounded = false;
if (colliders.Length > 2)
{
foreach (Collider2D hit in colliders){
if (hit != mainCollider){
grounded = true;
break;
}
}
}
rb.velocity = new Vector2(moveDirection * maxSpeed, rb.velocity.y);
Debug.DrawLine(groundCheckPos, groundCheckPos - new Vector3(0, colliderRadius, 0), grounded ? Color.green : Color.red);
Debug.DrawLine(groundCheckPos, groundCheckPos - new Vector3(colliderRadius, 0, 0), grounded ? Color.green : Color.red);
}
}

View File

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

View File

@@ -0,0 +1,99 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CharControllerMod : MonoBehaviour
{
public float maxSpeed = 3.4f;
public float jumpHeight = 6.5f;
public float gravityScale = 1.5f;
public Camera mainCamera;
bool facingRight = true;
public bool grounded = false;
Vector3 cameraPos;
float moveDirection = 0;
Rigidbody2D rb;
CapsuleCollider2D mainCollider;
CapsuleCollider2D friction;
Transform t;
// Start is called before the first frame update
void Start()
{
t = transform;
rb = GetComponent<Rigidbody2D>();
mainCollider = GetComponent<CapsuleCollider2D>();
friction = GetComponent<CapsuleCollider2D>();
rb.freezeRotation = true;
rb.gravityScale = gravityScale;
if(mainCamera)
{
cameraPos = mainCamera.transform.position;
}
}
// Update is called once per frame
void Update()
{
//if(grounded || Mathf.Abs(rb.velocity.x) > 0.01f)
moveDirection = Input.GetAxisRaw("Horizontal");
if(moveDirection != 0)
{
if (moveDirection > 0 && !facingRight)
{
facingRight = true;
t.localScale = new Vector3(Mathf.Abs(t.localScale.x), t.localScale.y, transform.localScale.z);
}
if (moveDirection < 0 && facingRight)
{
facingRight = false;
t.localScale = new Vector3(-Mathf.Abs(t.localScale.x), t.localScale.y, t.localScale.z);
}
}
if(Input.GetButtonDown("Jump") && grounded)
{
rb.velocity = new Vector2(rb.velocity.x, jumpHeight);
}
if (mainCamera)
{
mainCamera.transform.position = new Vector3(t.position.x, t.position.y, cameraPos.z);
}
}
void FixedUpdate()
{
Bounds colliderBounds = mainCollider.bounds;
float colliderRadius = mainCollider.size.x * 0.4f * Mathf.Abs(transform.localScale.x);
Vector3 groundCheckPos = colliderBounds.min + new Vector3(colliderBounds.size.x * 0.5f, colliderRadius * 0.9f, 0);
Collider2D[] colliders = Physics2D.OverlapCircleAll(groundCheckPos, colliderRadius);
grounded = false;
if (colliders.Length > 2)
{
foreach (Collider2D hit in colliders){
if (hit != mainCollider){
grounded = true;
break;
}
}
}
rb.velocity = new Vector2(moveDirection * maxSpeed, rb.velocity.y);
Debug.DrawLine(groundCheckPos, groundCheckPos - new Vector3(0, colliderRadius, 0), grounded ? Color.green : Color.red);
Debug.DrawLine(groundCheckPos, groundCheckPos - new Vector3(colliderRadius, 0, 0), grounded ? Color.green : Color.red);
}
}

View File

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

View File

@@ -0,0 +1,48 @@
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;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bef524aa2ad305d4faf6b90a610e5be4
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 Enemy : MonoBehaviour
{
public float maxSpeed;
private Rigidbody2D rb;
private CapsuleCollider2D cc;
private SpriteRenderer sr;
void Start()
{
rb = GetComponent<Rigidbody2D>();
cc = GetComponent<CapsuleCollider2D>();
sr = GetComponent<SpriteRenderer>();
}
// Update is called once per frame
void FixedUpdate()
{
rb.velocity = new Vector2(maxSpeed, rb.velocity.y);
}
void OnTriggerEnter2D(Collider2D cc)
{
if (!cc.gameObject.CompareTag("Player"))
{
maxSpeed = -maxSpeed;
sr.flipX = !sr.flipX;
}
}
}

View File

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

View File

@@ -0,0 +1,57 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FadingPlatform : MonoBehaviour
{
private SpriteRenderer spriteRenderer;
private BoxCollider2D col;
private EdgeCollider2D edge;
public float fadeTime;
public float refractoryTime;
private bool gone;
void Start()
{
spriteRenderer = GetComponent<SpriteRenderer>();
col = GetComponent<BoxCollider2D>();
edge = GetComponent<EdgeCollider2D>();
gone = false;
}
void Update()
{
if(gone)
{
StartCoroutine(Switch());
}
}
void OnTriggerEnter2D(Collider2D edge) {
if(!gone){
StartCoroutine(Switch());
}
}
// Muss IEnumerator sein weil ich ansonsten den Timer nicht implementieren kann
IEnumerator Switch(){
if(gone)
{
yield return new WaitForSeconds (refractoryTime);
spriteRenderer.enabled = true;
col.enabled = true;
edge.enabled = true;
gone = false;
} else {
yield return new WaitForSeconds (fadeTime);
spriteRenderer.enabled = false;
col.enabled = false;
edge.enabled = false;
gone = true;
}
}
}

View File

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

View File

@@ -0,0 +1,40 @@
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
public class InventoryBasic : MonoBehaviour
{
private List<GameObject> items;
// Start is called before the first frame update
void Start()
{
items = new List<GameObject>();
}
// Update is called once per frame
void Update()
{
}
private void OnCollisionEnter2D(Collision2D other)
{
switch (other.gameObject.tag) // switch-case hier damit in zukunft einfach fälle hinzugefügt werden können
{
case "Item":
other.gameObject.SetActive(false);
items.Add(other.gameObject);
Debug.Log("Pickup: Take " + other.gameObject.name);
break;
case "Openable":
// Entfernt den ersten "Key" welcher unter den Items gefunden wird, falls es einen gibt
if ( items.Remove((from item in items where item.name == "Key" select item).First()) )
{ // falls ein "Key" gefunden wurde, wird dieser genutzt
other.gameObject.SetActive(false);
Debug.Log("Pickup: Use Key");
}
break;
}
}
}

View File

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

View File

@@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class IsMovingTester : MonoBehaviour
{
private Animator animator;
private Rigidbody2D rb;
void Start()
{
animator = GetComponent<Animator>();
rb = GetComponent<Rigidbody2D>();
}
void Update()
{
if (rb.velocity.magnitude > 0.1f)
{
animator.SetBool("IsMoving", true);
}
else
{
animator.SetBool("IsMoving", false);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4760965f3d035f84db6a6741d746428c
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

@@ -0,0 +1,40 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MovingPlatform : MonoBehaviour
{
public float speed;
public int startingPoint;
public Transform[] points;
private int i;
void Start()
{
transform.position = points[startingPoint].position;
}
// Update is called once per frame
void Update()
{
if (Vector2.Distance(transform.position, points[i].position)<0.02f)
{
i++;
if(i==points.Length)
{
i = 0;
}
}
transform.position = Vector2.MoveTowards(transform.position, points[i].position, speed * Time.deltaTime);
}
private void OnCollisionEnter2D(Collision2D coll)
{
coll.transform.SetParent(transform);
}
private void OnCollisionExit2D(Collision2D coll)
{
coll.transform.SetParent(null);
}
}

View File

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

View File

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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6c98bff63d012cd46ae3f1da27d9c742
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 ObjPressurePlateMod: MonoBehaviour
{
public GameObject door;
// 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("PressurePlatable")){
door.SetActive(false);
}
}
/*
void OnTriggerExit2D(Collider2D other) {
if (other.CompareTag("PressurePlatable")) {
door.SetActive(true);
}
}
*/
}

View File

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

View File

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

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f4fc276bfd5b40942b9ca5950733343d
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 PlayerPressurePlateMod: MonoBehaviour
{
public GameObject door;
// 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")) {
// spriteRenderer.sprite = activatedSprite;
//}
door.SetActive(false);
}
/*
void OnTriggerExit2D(Collider2D other) {
if (other.CompareTag("Player")) {
spriteRenderer.sprite = originalSprite;
}
}
*/
}

View File

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

View File

@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/*
Sends the necessary Requests to the CameraController saying "Hi i want to be rendered"
The CameraController then obliges like the nice Guy he is :)
*/
public class ReactiveCamera : MonoBehaviour
{
[SerializeField] private Camera cam;
[SerializeField] private EdgeCollider2D col;
Rigidbody2D rb;
void Start()
{
col = GetComponent<EdgeCollider2D>();
rb = GetComponent<Rigidbody2D>();
cam = GetComponentInChildren<Camera>();
rb.isKinematic = true;
CameraController.Register(cam);
}
// Update is called once per frame
void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.CompareTag("Player"))
{
if(CameraController.CurrentCamera() != cam) CameraController.ActivateCamera(cam);
}
}
}

View File

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

View File

@@ -0,0 +1,24 @@
using UnityEngine;
public class respawn : MonoBehaviour
{
public GameObject player;
public Transform respawnPoint;
void Start()
{
}
void Update()
{
}
private void OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.CompareTag("Player"))
{
player.transform.position = respawnPoint.position;
Debug.Log("Respawn: Move");
}
}
}

View File

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

View File

@@ -0,0 +1,22 @@
using UnityEngine.SceneManagement;
using UnityEngine;
public class respawnReload : MonoBehaviour
{
void Start()
{
}
void Update()
{
}
private void OnCollisionEnter2D(Collision2D other)
{
if (other.gameObject.CompareTag("Player"))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
Debug.Log("Respawn: Reload");
}
}
}

View File

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