Neues Script

This commit is contained in:
2025-09-26 08:32:47 +02:00
parent 4483bb5db8
commit 439215614b
6 changed files with 353 additions and 13 deletions

View File

@@ -239,6 +239,7 @@ GameObject:
- component: {fileID: 330585545} - component: {fileID: 330585545}
- component: {fileID: 330585544} - component: {fileID: 330585544}
- component: {fileID: 330585547} - component: {fileID: 330585547}
- component: {fileID: 330585548}
m_Layer: 0 m_Layer: 0
m_Name: Main Camera m_Name: Main Camera
m_TagString: MainCamera m_TagString: MainCamera
@@ -364,6 +365,28 @@ MonoBehaviour:
m_MipBias: 0 m_MipBias: 0
m_VarianceClampScale: 0.9 m_VarianceClampScale: 0.9
m_ContrastAdaptiveSharpening: 0 m_ContrastAdaptiveSharpening: 0
--- !u!114 &330585548
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 330585543}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c9abe543b11ffd848a05bfacb99512fb, type: 3}
m_Name:
m_EditorClassIdentifier:
unterschrank: {fileID: 1226968860}
aquarium: {fileID: 827936917}
elektronik: {fileID: 1048975205}
duengerFlaschen: {fileID: 1518591050}
testFlaschen: {fileID: 2130494277}
fischfutter: {fileID: 809139278}
fisch1: {fileID: 0}
fisch2: {fileID: 0}
pflanzen: {fileID: 0}
weiter: 275
--- !u!1 &410087039 --- !u!1 &410087039
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -983,6 +1006,9 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: -8679921383154817045, guid: 52b92fdb14f33884baf4a43477cb083c, type: 3} - targetCorrespondingSourceObject: {fileID: -8679921383154817045, guid: 52b92fdb14f33884baf4a43477cb083c, type: 3}
insertIndex: -1 insertIndex: -1
addedObject: {fileID: 1992194362} addedObject: {fileID: 1992194362}
- targetCorrespondingSourceObject: {fileID: -8679921383154817045, guid: 52b92fdb14f33884baf4a43477cb083c, type: 3}
insertIndex: -1
addedObject: {fileID: 1653188870}
m_AddedComponents: m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 52b92fdb14f33884baf4a43477cb083c, type: 3} - targetCorrespondingSourceObject: {fileID: 919132149155446097, guid: 52b92fdb14f33884baf4a43477cb083c, type: 3}
insertIndex: -1 insertIndex: -1
@@ -1964,6 +1990,11 @@ PrefabInstance:
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: [] m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 10ce1ce4c10044246ba2702ecd59f38a, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 10ce1ce4c10044246ba2702ecd59f38a, type: 3}
--- !u!1 &1226968860 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 919132149155446097, guid: 10ce1ce4c10044246ba2702ecd59f38a, type: 3}
m_PrefabInstance: {fileID: 1226968859}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1255467087 --- !u!1 &1255467087
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -2455,31 +2486,31 @@ PrefabInstance:
serializedVersion: 2 serializedVersion: 2
m_Modification: m_Modification:
serializedVersion: 3 serializedVersion: 3
m_TransformParent: {fileID: 0} m_TransformParent: {fileID: 827936919}
m_Modifications: m_Modifications:
- target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3} - target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3}
propertyPath: m_LocalScale.x propertyPath: m_LocalScale.x
value: 90 value: 1.6363641
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3} - target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3}
propertyPath: m_LocalScale.y propertyPath: m_LocalScale.y
value: 183.95 value: 5.5733128
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3} - target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3}
propertyPath: m_LocalScale.z propertyPath: m_LocalScale.z
value: 90 value: 3.2727268
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3} - target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3}
propertyPath: m_LocalPosition.x propertyPath: m_LocalPosition.x
value: -2.018 value: -0.000018180499
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3} - target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3}
propertyPath: m_LocalPosition.y propertyPath: m_LocalPosition.y
value: 0.92 value: 0.002457164
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3} - target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3}
propertyPath: m_LocalPosition.z propertyPath: m_LocalPosition.z
value: -2.21 value: 0.022581821
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3} - target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3}
propertyPath: m_LocalRotation.w propertyPath: m_LocalRotation.w
@@ -2487,15 +2518,15 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3} - target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3}
propertyPath: m_LocalRotation.x propertyPath: m_LocalRotation.x
value: 0 value: -0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3} - target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3}
propertyPath: m_LocalRotation.y propertyPath: m_LocalRotation.y
value: 0.7071068 value: -0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3} - target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3}
propertyPath: m_LocalRotation.z propertyPath: m_LocalRotation.z
value: 0.7071068 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3} - target: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3}
propertyPath: m_LocalEulerAnglesHint.x propertyPath: m_LocalEulerAnglesHint.x
@@ -2526,6 +2557,11 @@ PrefabInstance:
m_AddedGameObjects: [] m_AddedGameObjects: []
m_AddedComponents: [] m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3} m_SourcePrefab: {fileID: 100100000, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3}
--- !u!4 &1653188870 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: f61bcc9191e790e4fa28c1c289eca462, type: 3}
m_PrefabInstance: {fileID: 1653188869}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1677791534 --- !u!1001 &1677791534
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -3245,5 +3281,4 @@ SceneRoots:
- {fileID: 1518591051} - {fileID: 1518591051}
- {fileID: 809139279} - {fileID: 809139279}
- {fileID: 626182426} - {fileID: 626182426}
- {fileID: 1653188869}
- {fileID: 1048975206} - {fileID: 1048975206}

View File

@@ -0,0 +1,116 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine;
using TMPro;
using Unity.VisualScripting;
using UnityEngine.SceneManagement;
public class ManageDialogue : MonoBehaviour
{
public static ManageDialogue Instance;
public KeyCode continueKey = KeyCode.Space;
public Canvas canvas;
public Image characterIcon;
public TextMeshProUGUI characterName;
public TextMeshPro characterDerscription;
public TextMeshProUGUI dialogueArea;
private Queue<DialogueLine> lines;
public bool isDialogueActive = false;
public float typingSpeed = 0.2f;
public Animator animator;
public bool finishedAll = false;
void Start()
{
canvas = GetComponent<Canvas>();
canvas.enabled = false;
}
private void Awake()
{
if (Instance == null)
Instance = this;
lines = new Queue<DialogueLine>();
}
public void StartDialogue(Dialogue dialogue)
{
isDialogueActive = true;
animator.Play("show");
lines.Clear();
foreach (DialogueLine dialogueLine in dialogue.dialogueLines)
{
lines.Enqueue(dialogueLine);
}
DisplayNextDialogueLine();
}
public void DisplayNextDialogueLine()
{
if (lines.Count == 0)
{
EndDialogue();
return;
}
DialogueLine currentLine = lines.Dequeue();
characterIcon.sprite = currentLine.character.icon;
characterName.text = currentLine.character.name;
StopAllCoroutines();
StartCoroutine(TypeSentence(currentLine));
}
IEnumerator TypeSentence(DialogueLine dialogueLine)
{
dialogueArea.text = "";
foreach (char letter in dialogueLine.line.ToCharArray())
{
dialogueArea.text += letter;
yield return new WaitForSeconds(typingSpeed);
}
}
void EndDialogue()
{
finishedAll = true;
isDialogueActive = false;
animator.Play("hide");
SceneManager.LoadSceneAsync(2);
}
private void Update()
{
if (Input.GetKeyDown(continueKey))
{
DisplayNextDialogueLine();
}
if (finishedAll == true)
{
canvas.enabled = !canvas.enabled;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 549a31f164332f64e9a9024efb126d6b

View File

@@ -1,16 +1,160 @@
using System.Numerics;
using UnityEngine; using UnityEngine;
public class PutInPlace : MonoBehaviour public class PutInPlace : MonoBehaviour
{ {
public GameObject unterschrank;
public GameObject aquarium;
public GameObject elektronik;
public GameObject duengerFlaschen;
public GameObject testFlaschen;
public GameObject fischfutter;
public GameObject fisch1;
public GameObject fisch2;
public GameObject pflanzen;
bool moveSchrankDone = false;
bool moveBeckenDone = false;
bool moveElektroDone = false;
bool moveDuengerDone = false;
bool moveTestsDone = false;
bool moveFutterDone = false;
bool movePlantDone = false;
bool moveFisch1Done = false;
bool moveFisch2Done = false;
[SerializeField] KeyCode weiter;
// Start is called once before the first execution of Update after the MonoBehaviour is created // Start is called once before the first execution of Update after the MonoBehaviour is created
void Start() void Start()
{ {
unterschrank.SetActive(false);
aquarium.SetActive(false);
elektronik.SetActive(false);
duengerFlaschen.SetActive(false);
testFlaschen.SetActive(false);
fischfutter.SetActive(false);
pflanzen.SetActive(false);
fisch1.SetActive(false);
fisch2.SetActive(false);
} }
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if (Input.GetKey(weiter))
{
if (moveSchrankDone == false)
{
MoveSchrank();
}
if (moveSchrankDone == true && moveBeckenDone == false)
{
MoveBecken();
}
if (moveBeckenDone == true && moveElektroDone == false)
{
MoveElektro();
}
if(moveElektroDone == true && moveDuengerDone == false)
{
MoveDuenger();
}
if(moveElektroDone == true && moveTestsDone == false)
{
MoveTests();
}
if(moveTestsDone == true && moveFutterDone == false)
{
MoveFutter();
}
if(moveFutterDone == true && movePlantDone == false)
{
MovePlant();
}
if(movePlantDone == true && moveFisch1Done == false)
{
MoveFisch1();
}
if(moveFisch1Done == true && moveFisch2Done == false)
{
MoveFisch2();
}
}
}
public void MoveSchrank()
{
//unterschrank.transform.position += new Vector3(-2.015, 0.188, -2.1306);
unterschrank.SetActive(true);
moveSchrankDone = true;
}
public void MoveBecken()
{
aquarium.SetActive(true);
moveBeckenDone = true;
}
public void MoveElektro()
{
elektronik.SetActive(true);
moveElektroDone = true;
}
public void MoveDuenger()
{
duengerFlaschen.SetActive(true);
moveDuengerDone = true;
}
public void MoveTests()
{
testFlaschen.SetActive(true);
moveTestsDone = true;
}
public void MoveFutter()
{
fischfutter.SetActive(true);
moveFutterDone = true;
}
public void MovePlant()
{
pflanzen.SetActive(true);
movePlantDone = true;
}
public void MoveFisch1()
{
fisch1.SetActive(true);
moveFisch1Done = true;
}
public void MoveFisch2()
{
fisch2.SetActive(true);
moveFisch2Done = true;
} }
} }

View File

@@ -0,0 +1,41 @@
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class DialogueCharacter
{
public string name;
public Sprite icon;
}
[System.Serializable]
public class DialogueLine
{
public DialogueCharacter character;
[TextArea(3, 10)]
public string line;
}
[System.Serializable]
public class Dialogue
{
public List<DialogueLine> dialogueLines = new List<DialogueLine>();
}
public class TriggerDialogue : MonoBehaviour
{
public Dialogue dialogue;
public void TriggerTheDialogue()
{
ManageDialogue.Instance.StartDialogue(dialogue);
}
private void OnTriggerEnter2D(Collider2D collision)
{
if (collision.tag == "Player")
{
TriggerTheDialogue();
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 4dad8af36b57ad04daa28033935f85bf