Compare commits

...

3 commits

19 changed files with 2645 additions and 48 deletions

View file

@ -63,18 +63,20 @@ public class AblaufKleinerStern2 : MonoBehaviour
kleinerStern.transform.position = new Vector2(-0.8f, 6.0f);
hase.transform.position = new Vector2(11, -4);
hase.GetComponent<HaseBewegung>().Turn();
SternBewegung sternBewegung = kleinerStern.GetComponent<SternBewegung>();
scheduleNewTask(2.5f, delegate(){
sternRigBod.simulated = false;
SternBewegung sternBewegung = kleinerStern.GetComponent<SternBewegung>();
sternBewegung.enabled = true;
sternBewegung.GoToPositionWithVelocity(new Vector2(-2.1f, -2.6f), 1);
hase.GetComponent<Rigidbody2D>().simulated = true;
});
scheduleNewTask(2.52f, delegate(){
sternBewegung.GoToPositionWithVelocity(new Vector2(-1.4f, -3.2f), 1);
});
nextStep = AuftrittHase;
}
private void AuftrittHase(){
hase.GetComponent<HaseBewegung>().GoToXPosition(2.0f);
hase.GetComponent<HaseBewegung>().GoToXPosition(2.2f);
nextStep = Abgang;
}
@ -83,7 +85,7 @@ public class AblaufKleinerStern2 : MonoBehaviour
haseBewegung.GoToXPosition(15);
haseBewegung.Turn();
SternBewegung sternBewegung = kleinerStern.GetComponent<SternBewegung>();
sternBewegung.GoToPositionWithVelocity(new Vector2(12, 0), haseBewegung.jumpVelocityX * .8f);
sternBewegung.GoToPositionWithVelocity(new Vector2(12, 0), haseBewegung.jumpVelocityX * .9f);
sternBewegung.randomnessIntensity = 1;
sternBewegung.randomnessBaseAngle = 5;
sternBewegung.randomMovementDuration = .6f;

View file

@ -0,0 +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(){
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(){};
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: be39dfb47ed7a3c0b89e66f9a0dbdf23

View file

@ -0,0 +1,72 @@
using System;
using System.Linq;
using Unity.Mathematics;
using UnityEngine;
public class FigurMitBeinenBewegung : MonoBehaviour
{
public GameObject[] wobblingParts;
public float[] wobblingMaxAngles;
public bool[] wobblingInversed;
public float wobblingPeriod;
public float movementVelocity;
private float movementStartTime;
private float targetPositionX;
private bool moving;
private bool wobbling;
private float lastPhase;
public void GoToXPosition(float x) {
targetPositionX = x;
movementStartTime = Time.time;
moving = true;
wobbling = true;
if (x > transform.position.x) {
transform.rotation = Quaternion.identity;
} else if (x < transform.position.x) {
transform.rotation = Quaternion.AngleAxis(180, Vector3.up);
}
}
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
targetPositionX = transform.position.x;
moving = false;
wobbling = false;
lastPhase = 0;
}
// Update is called once per frame
void Update()
{
if (moving){
float deltaX = Time.deltaTime * movementVelocity;
if (targetPositionX - transform.position.x < 0){
deltaX *= -1;
}
if ((transform.position.x - targetPositionX) * (transform.position.x + deltaX - targetPositionX) <= 0){
transform.position = new Vector2(targetPositionX, transform.position.y);
moving = false;
} else {
transform.position += Vector3.right * deltaX;
}
}
if (wobbling){
float phase = math.sin((Time.time - movementStartTime) * math.PI2 / wobblingPeriod);
if (!moving && phase * lastPhase <= 0){
wobbling = false;
phase = 0;
}
lastPhase = phase;
for (int i = 0; i < wobblingParts.Length; i++){
float angle = phase * wobblingMaxAngles[i];
if (wobblingInversed[i]){
angle *= -1;
}
wobblingParts[i].transform.localRotation = Quaternion.AngleAxis(angle, Vector3.forward);
}
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8b2b3cf9e9fd7e2078e1e71f1cb3938a

View file

@ -96,10 +96,16 @@ public class HaseBewegung : MonoBehaviour
lastEarAngle = earAngle;
loeffel.transform.localRotation = Quaternion.AngleAxis(earAngle, Vector3.forward);
float timeFactor = (Time.time - jumpStartTime) / HINTERLAUF_TIME;
Vector3 rotationAxis;
if (lookingRight) {
rotationAxis = Vector3.back;
} else {
rotationAxis = Vector3.forward;
}
if (timeFactor < .5f){
hinterlauf.transform.localRotation = Quaternion.AngleAxis(MAX_HINTERLAUF_ANGLE * timeFactor * 2, Vector3.forward);
hinterlauf.transform.localRotation = Quaternion.AngleAxis(MAX_HINTERLAUF_ANGLE * timeFactor * 2, rotationAxis);
} else if (timeFactor < 1.0f){
hinterlauf.transform.localRotation = Quaternion.AngleAxis(MAX_HINTERLAUF_ANGLE * (1 - timeFactor) * 2, Vector3.forward);
hinterlauf.transform.localRotation = Quaternion.AngleAxis(MAX_HINTERLAUF_ANGLE * (1 - timeFactor) * 2, rotationAxis);
} else {
hinterlauf.transform.localRotation = Quaternion.identity;
}

View file

@ -455,8 +455,8 @@ MonoBehaviour:
randomnessIntensity: 0.05
randomnessBaseAngle: 5
randomMovementDuration: 0.7
wobblingAngle: 8
wobblingDuration: 2
wobblingAngle: 6
wobblingDuration: 4
angularVelocity: 0
--- !u!1 &888920047
GameObject:

File diff suppressed because it is too large Load diff

View file

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

View file

@ -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:

View file

@ -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:

View file

@ -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:

View file

@ -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:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 0
width: 132
height: 666
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.40496087, y: 0.89557004}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: ee993b28a6a422463a15d88a2e57a5d4
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
Maria auf Esel - Eselbein1_0: -2314117792804241221
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 0
width: 131
height: 643
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.69153017, y: 1.0462925}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: c33502a410fe423538737deeb445325a
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
Maria auf Esel - Eselbein2_0: -6640877963095185480
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 0
width: 243
height: 680
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.5258131, y: 0.94277257}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: 87be1ac543cacb5d8bfd16021a4003b5
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
Maria auf Esel - Eselbein3_0: -4514926496411855965
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 0
width: 214
height: 657
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.79311264, y: 1.015557}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: 33b614e7f023635b39d50ba10fe0fd46
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
Maria auf Esel - Eselbein4_0: 2075278806595872617
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 643
width: 798
height: 1088
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.24846677, y: 0.51729584}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: 38df9f30a8a6cb2b780fde372695ff18
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
Maria auf Esel - Eselkopf_0: 2698551319815246180
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:

View file

@ -120,8 +120,8 @@ TextureImporter:
y: 379
width: 282
height: 750
alignment: 0
pivot: {x: 0, y: 0}
alignment: 9
pivot: {x: 0.7446762, y: 0.90981036}
border: {x: 0, y: 0, z: 0, w: 0}
customData:
outline: []
@ -138,7 +138,7 @@ TextureImporter:
customData:
physicsShape: []
bones: []
spriteID:
spriteID: d52d92352666e59cea3e14ed23318bfa
internalID: 0
vertices: []
indices:
@ -147,7 +147,8 @@ TextureImporter:
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
nameFileIdTable:
Maria auf Esel - Schwanz_0: 2774470072328476467
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData: