52 lines
1.0 KiB
C#
52 lines
1.0 KiB
C#
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;
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|