Abschluss Kleiner Stern Szene 3
This commit is contained in:
parent
f610b443e2
commit
b3ce6bfd3f
6 changed files with 1305 additions and 19 deletions
|
|
@ -1,40 +1,122 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
public class AblaufKleinerStern3 : MonoBehaviour
|
||||
{
|
||||
public GameObject mariaAufEsel;
|
||||
public GameObject joseph;
|
||||
public GameObject hase;
|
||||
public GameObject kleinerStern;
|
||||
public GameObject globalLight;
|
||||
|
||||
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()
|
||||
{
|
||||
nextStep = AuftrittMariaUndJoseph;
|
||||
taskList = new();
|
||||
mariaAufEsel.transform.position = new Vector2(targetMaria - mariaJosephStreckeAuftritt, -1.5f);
|
||||
joseph.transform.position = new Vector2(targetJoseph - mariaJosephStreckeAuftritt, -2.81f);
|
||||
kleinerStern.transform.position = new Vector2(10.2f, 3.0f);
|
||||
hase.transform.position = new Vector2(10.5f, -4.33f);
|
||||
hase.GetComponent<Rigidbody2D>().simulated = false;
|
||||
globalLight.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)){
|
||||
nextStep();
|
||||
}
|
||||
}
|
||||
|
||||
private void scheduleNewTask(float timeFromNow, Action action){
|
||||
Task t = new(action, Time.time + timeFromNow);
|
||||
taskList.Add(t);
|
||||
}
|
||||
|
||||
private const float targetJoseph = -1.1f;
|
||||
private const float targetMaria = -5.5f;
|
||||
private const float targetStern = 3.5f;
|
||||
private const float targetHase = 5.0f;
|
||||
private const float kleinesStueck = 1.0f;
|
||||
private const float mariaJosephStreckeAuftritt = 6.5f;
|
||||
private void AuftrittMariaUndJoseph(){
|
||||
mariaAufEsel.GetComponent<FigurMitBeinenBewegung>().GoToXPosition(1);
|
||||
globalLight.GetComponent<Lichtsteuerung>().FadeToIntensity(1, 0.5f);
|
||||
FigurMitBeinenBewegung josephBewegung = joseph.GetComponent<FigurMitBeinenBewegung>();
|
||||
josephBewegung.GoToXPosition(targetJoseph);
|
||||
mariaAufEsel.GetComponent<FigurMitBeinenBewegung>().GoToXPosition(targetMaria);
|
||||
scheduleNewTask(mariaJosephStreckeAuftritt/josephBewegung.movementVelocity + 0.2f, delegate(){
|
||||
josephBewegung.GoToXPosition(targetJoseph - 0.01f);
|
||||
});
|
||||
nextStep = AuftrittKleinerStern;
|
||||
}
|
||||
|
||||
private void AuftrittKleinerStern(){
|
||||
kleinerStern.GetComponent<SternBewegung>().GoToPositionWithVelocity(new Vector2(targetStern, 3.0f), 1);
|
||||
HaseBewegung haseBewegung = hase.GetComponent<HaseBewegung>();
|
||||
haseBewegung.Turn();
|
||||
haseBewegung.GoToXPosition(targetHase);
|
||||
hase.GetComponent<Rigidbody2D>().simulated = true;
|
||||
scheduleNewTask(1.5f, delegate(){
|
||||
joseph.GetComponent<FigurMitBeinenBewegung>().GoToXPosition(targetJoseph);
|
||||
});
|
||||
nextStep = EinStueckWeiter;
|
||||
}
|
||||
|
||||
private void EinStueckWeiter(){
|
||||
joseph.GetComponent<FigurMitBeinenBewegung>().GoToXPosition(targetJoseph + kleinesStueck);
|
||||
mariaAufEsel.GetComponent<FigurMitBeinenBewegung>().GoToXPosition(targetMaria + kleinesStueck);
|
||||
scheduleNewTask(0.5f, delegate(){
|
||||
kleinerStern.GetComponent<SternBewegung>().GoToPositionWithVelocity(new Vector2(targetStern + kleinesStueck, 3.0f), 1);
|
||||
HaseBewegung haseBewegung = hase.GetComponent<HaseBewegung>();
|
||||
haseBewegung.Turn();
|
||||
haseBewegung.GoToXPosition(targetHase + kleinesStueck);
|
||||
});
|
||||
nextStep = Abgang;
|
||||
}
|
||||
|
||||
private void Abgang(){
|
||||
joseph.GetComponent<FigurMitBeinenBewegung>().GoToXPosition(20);
|
||||
mariaAufEsel.GetComponent<FigurMitBeinenBewegung>().GoToXPosition(20);
|
||||
scheduleNewTask(0.5f, delegate(){
|
||||
kleinerStern.GetComponent<SternBewegung>().GoToPositionWithVelocity(new Vector2(20, 3.0f), 1);
|
||||
hase.GetComponent<HaseBewegung>().GoToXPosition(20);
|
||||
});
|
||||
scheduleNewTask(3, delegate(){
|
||||
globalLight.GetComponent<Lichtsteuerung>().FadeToIntensity(0, 1);
|
||||
});
|
||||
nextStep = delegate(){};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -120,8 +120,8 @@ TextureImporter:
|
|||
y: 56
|
||||
width: 338
|
||||
height: 307
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
alignment: 9
|
||||
pivot: {x: 0.4341242, y: 1.587916}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
|
|
@ -138,7 +138,7 @@ TextureImporter:
|
|||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
spriteID: fb74629ec71fc1c52be1e5e940d97f9b
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
|
|
@ -147,7 +147,8 @@ TextureImporter:
|
|||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
nameFileIdTable:
|
||||
Joseph - Bein1_0: 1124802014317861886
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
|
|
|
|||
|
|
@ -120,8 +120,8 @@ TextureImporter:
|
|||
y: 81
|
||||
width: 336
|
||||
height: 384
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
alignment: 9
|
||||
pivot: {x: 0.20179458, y: 1.6306964}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
|
|
@ -138,7 +138,7 @@ TextureImporter:
|
|||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
spriteID: b04db1ef1ff15ba11b7e27f3dadf48c3
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
|
|
@ -147,7 +147,8 @@ TextureImporter:
|
|||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
nameFileIdTable:
|
||||
Joseph - Bein2_0: 8158471680843697196
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
|
|
|
|||
|
|
@ -120,8 +120,8 @@ TextureImporter:
|
|||
y: 2076
|
||||
width: 599
|
||||
height: 625
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
alignment: 9
|
||||
pivot: {x: 0.32653075, y: 0.14374375}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
|
|
@ -138,7 +138,7 @@ TextureImporter:
|
|||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
spriteID: e52613659db6b8d1fa6c74cca782e427
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
|
|
@ -147,7 +147,8 @@ TextureImporter:
|
|||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
nameFileIdTable:
|
||||
Joseph - Kopf_0: -8650000345817158003
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
|
|
|
|||
|
|
@ -120,8 +120,8 @@ TextureImporter:
|
|||
y: 78
|
||||
width: 221
|
||||
height: 2239
|
||||
alignment: 0
|
||||
pivot: {x: 0, y: 0}
|
||||
alignment: 9
|
||||
pivot: {x: 0.31528994, y: 0.64088225}
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
customData:
|
||||
outline: []
|
||||
|
|
@ -138,7 +138,7 @@ TextureImporter:
|
|||
customData:
|
||||
physicsShape: []
|
||||
bones: []
|
||||
spriteID:
|
||||
spriteID: c37860ed8869230cbb3cd8de0d8a1fcf
|
||||
internalID: 0
|
||||
vertices: []
|
||||
indices:
|
||||
|
|
@ -147,7 +147,8 @@ TextureImporter:
|
|||
secondaryTextures: []
|
||||
spriteCustomMetadata:
|
||||
entries: []
|
||||
nameFileIdTable: {}
|
||||
nameFileIdTable:
|
||||
Joseph - Stab_0: 5223624944866906508
|
||||
mipmapLimitGroupName:
|
||||
pSDRemoveMatte: 0
|
||||
userData:
|
||||
|
|
|
|||
Loading…
Reference in a new issue