Kleiner Stern Szene 6

This commit is contained in:
Philipp Sander 2024-12-20 12:56:25 +01:00
parent 2315245634
commit 5d91ec553a
13 changed files with 2351 additions and 36 deletions

View file

@ -0,0 +1,92 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Rendering.Universal;
public class AblaufKleinerStern6 : MonoBehaviour
{
public GameObject kleinerStern;
public GameObject grosserStern;
public GameObject grosserSternLicht;
public GameObject hirt1;
public GameObject hirt2;
private Action nextStep;
private class Task {
private Action action;
private float time;
public Task(Action action, float time){
this.action = action;
this.time = time;
}
public bool isDue(){
return Time.time >= time;
}
public void Do(){
action();
}
}
private List<Task> taskList;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
taskList = new();
nextStep = KleinerSternWachtAuf;
grosserStern.transform.position = new(targetGrosserStern - distanceHirten, 3.14f);
hirt1.transform.position = new(targetHirt1 - distanceHirten, -2.08f);
hirt2.transform.position = new(targetHirt2 - distanceHirten, -2.31f);
kleinerStern.GetComponent<Light2D>().intensity = 0;
grosserSternLicht.GetComponent<Light2D>().intensity = 0;
}
// Update is called once per frame
void Update()
{
List<Task> newlist = new();
foreach (Task t in taskList){
if (t.isDue()){
t.Do();
} else {
newlist.Add(t);
}
}
taskList = newlist;
if (Input.GetKeyDown(KeyCode.Space) && taskList.Count == 0){
nextStep();
}
}
private void scheduleNewTask(float timeFromNow, Action action){
Task t = new(action, Time.time + timeFromNow);
taskList.Add(t);
}
private const float targetHirt1 = -3.46f;
private const float targetHirt2 = -6.68f;
private const float targetGrosserStern = -0.37f;
private const float distanceHirten = 12;
private void KleinerSternWachtAuf(){
kleinerStern.GetComponent<Lichtsteuerung>().FadeToIntensity(1, 2);
nextStep = HirtenKommen;
}
private void HirtenKommen(){
grosserSternLicht.GetComponent<Lichtsteuerung>().FadeToIntensity(1, 7);
scheduleNewTask(4, delegate(){
hirt1.GetComponent<FigurMitBeinenBewegung>().GoToXPosition(targetHirt1);
hirt2.GetComponent<FigurMitBeinenBewegung>().GoToXPosition(targetHirt2);
grosserStern.GetComponent<SternBewegung>().GoToPositionWithVelocity(new(targetGrosserStern, 3.14f), 1);
});
nextStep = Ende;
}
private void Ende(){
grosserSternLicht.GetComponent<Lichtsteuerung>().FadeToIntensity(0, 2.5f);
kleinerStern.GetComponent<Lichtsteuerung>().FadeToIntensity(0, 2.5f);
nextStep = delegate(){};
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 61b60d4d7ed96458f9f135bb3e4175ab

File diff suppressed because it is too large Load diff

View file

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

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 43
width: 589
height: 2470
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: -0.37978685, y: 0.60374486}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: 78aa456745281d6d9a3af790a8982e58
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
Hirt mit Schaf - Arm mit Stab_0: -8752244071079205122
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 7
width: 253
height: 309
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.36495382, y: 1.5688599}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: 82c7b4bf172e403629636aaa05db13c7
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
Hirt mit Schaf - Bein1_0: -6573361990312122736
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 0
width: 296
height: 307
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.11524015, y: 1.8726026}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: 5c4c6906b15339e17be1f2d7941be8b5
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
Hirt mit Schaf - Bein2_0: -7506113247454869990
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 99
width: 93
height: 262
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.3163083, y: 1.4128501}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: 6f1e3e81c5159a046964e9fbfdc4051c
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
Hirt mit Schaf - Schafbein1_0: -4479054387389368907
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 94
width: 135
height: 258
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.2047325, y: 1.2945731}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: 9d61d4969fa048ce19668f78d1f79621
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
Hirt mit Schaf - Schafbein2_0: -6030139249882164286
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 89
width: 72
height: 329
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.5, y: 1.0884839}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: c4fb082010e9f2833a5ac9099328a5b2
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
Hirt mit Schaf - Schafbein3_0: -8647024433723020247
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 74
width: 113
height: 378
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.5, y: 1.0121987}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: bc345c2b3e9aa13b0bfd93ee04372177
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
Hirt mit Schaf - Schafbein4_0: 8651122685281617994
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 1501
width: 913
height: 741
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.16688058, y: 0.1990087}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: 802153d26402373d0ac58033bb012a4c
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
"Fl\xF6tenhirt - Arm mit Fl\xF6te_0": 3791590272802589746
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 0
width: 464
height: 491
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.4126039, y: 1.3424188}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: 0487845ede1778b9eb808091fca4da38
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
"Fl\xF6tenhirt - Bein_0": 2443396168602163680
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData: