6 Commits

Author SHA1 Message Date
jlink 4a4e3be216 Movement anpassungen (no slide while push) 2026-01-24 13:27:39 +01:00
jlink 3257f23245 Pit more versatile 2026-01-23 19:20:39 +01:00
jlink 9c1ac2c040 s 2026-01-23 18:39:33 +01:00
jlink 2668c0774e sounds 2026-01-23 18:38:33 +01:00
jlink 2d93071bfc Sounds 2026-01-23 18:38:17 +01:00
jlink 521c86dbd4 Slide and Glide 2026-01-23 18:36:25 +01:00
11 changed files with 224 additions and 43 deletions
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8ecf27f8ef94e904981b6ec7f5363702
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 140426efa0ba27942bd569222ed3a9f4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4b37e6f7170b25c4db6a0c78dfa46e57
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+104 -7
View File
@@ -119,6 +119,73 @@ NavMeshSettings:
debug: debug:
m_Flags: 0 m_Flags: 0
m_NavMeshData: {fileID: 0} m_NavMeshData: {fileID: 0}
--- !u!1 &67018399
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 67018400}
- component: {fileID: 67018402}
- component: {fileID: 67018401}
m_Layer: 0
m_Name: StandUpCollider
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &67018400
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 67018399}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 955231359}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &67018401
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 67018399}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 19aae932aa4446c4788d84deb1116128, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::StandUpCollider
ispushing: 0
--- !u!135 &67018402
SphereCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 67018399}
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_IsTrigger: 1
m_ProvidesContacts: 0
m_Enabled: 1
serializedVersion: 3
m_Radius: 2
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &209519236 --- !u!1 &209519236
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -281,6 +348,7 @@ GameObject:
- component: {fileID: 319279593} - component: {fileID: 319279593}
- component: {fileID: 319279592} - component: {fileID: 319279592}
- component: {fileID: 319279598} - component: {fileID: 319279598}
- component: {fileID: 319279599}
m_Layer: 0 m_Layer: 0
m_Name: IceBlock m_Name: IceBlock
m_TagString: IceBlock m_TagString: IceBlock
@@ -423,7 +491,7 @@ Transform:
m_GameObject: {fileID: 319279591} m_GameObject: {fileID: 319279591}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -12.2, y: 1.51404, z: 15.37} m_LocalPosition: {x: -12.4, y: 1.51404, z: 15.37}
m_LocalScale: {x: 2, y: 2, z: 2} m_LocalScale: {x: 2, y: 2, z: 2}
m_ConstrainProportionsScale: 1 m_ConstrainProportionsScale: 1
m_Children: [] m_Children: []
@@ -442,7 +510,19 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::IceBlockPush m_EditorClassIdentifier: Assembly-CSharp::IceBlockPush
contactForce: 4 contactForce: 4
StartPos: {x: 9.4, y: 1.51404, z: 15.37} --- !u!114 &319279599
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 319279591}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8fc662358fbf8394d804207b2a8c9868, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PositionReset
StartPos: {x: 9.2, y: 1.51404, z: 15.37}
--- !u!1 &330585543 --- !u!1 &330585543
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -882,6 +962,7 @@ GameObject:
- component: {fileID: 955231356} - component: {fileID: 955231356}
- component: {fileID: 955231355} - component: {fileID: 955231355}
- component: {fileID: 955231360} - component: {fileID: 955231360}
- component: {fileID: 955231361}
m_Layer: 0 m_Layer: 0
m_Name: Penguin m_Name: Penguin
m_TagString: Untagged m_TagString: Untagged
@@ -1008,7 +1089,8 @@ Transform:
m_LocalPosition: {x: -15.5, y: 1.23, z: 12.73} m_LocalPosition: {x: -15.5, y: 1.23, z: 12.73}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children:
- {fileID: 67018400}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &955231360 --- !u!114 &955231360
@@ -1023,8 +1105,24 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9b9bab48a629093449f53dc5ea63d752, type: 3} m_Script: {fileID: 11500000, guid: 9b9bab48a629093449f53dc5ea63d752, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PlayerMove m_EditorClassIdentifier: Assembly-CSharp::PlayerMove
basespeed: 8
speed: 8 speed: 8
rb: {fileID: 0} speedincrease: 0.05
maxspeed: 15
slide: 0.2
standUp: {fileID: 0}
--- !u!114 &955231361
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 955231353}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8fc662358fbf8394d804207b2a8c9868, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PositionReset
StartPos: {x: -15.5, y: 1.23, z: 12.73} StartPos: {x: -15.5, y: 1.23, z: 12.73}
--- !u!1 &1262927943 --- !u!1 &1262927943
GameObject: GameObject:
@@ -1090,8 +1188,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e7c1c3fec0605d746bddf36d1b260908, type: 3} m_Script: {fileID: 11500000, guid: e7c1c3fec0605d746bddf36d1b260908, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Pit m_EditorClassIdentifier: Assembly-CSharp::Pit
player: {fileID: 955231360} startmass: 0
ice: {fileID: 319279598}
--- !u!4 &1604116872 --- !u!4 &1604116872
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -1101,7 +1198,7 @@ Transform:
m_GameObject: {fileID: 1604116870} m_GameObject: {fileID: 1604116870}
serializedVersion: 2 serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -2.3, y: -0.7, z: 13.1} m_LocalPosition: {x: -2.3, y: -2.37, z: 13.1}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
-6
View File
@@ -5,7 +5,6 @@ public class IceBlockPush : MonoBehaviour
{ {
[SerializeField] float contactForce = 2.5f; [SerializeField] float contactForce = 2.5f;
private Rigidbody rb; private Rigidbody rb;
[SerializeField] private Vector3 StartPos;
private void Start() private void Start()
{ {
@@ -35,9 +34,4 @@ public class IceBlockPush : MonoBehaviour
rb.AddForce(directionVector * contactForce, ForceMode.Impulse); rb.AddForce(directionVector * contactForce, ForceMode.Impulse);
} }
public void Reset()
{
this.transform.position = StartPos;
}
} }
+7 -21
View File
@@ -1,30 +1,16 @@
using System; using System;
using UnityEngine; using UnityEngine;
using UnityEngine.Serialization;
public class Pit : MonoBehaviour public class Pit : MonoBehaviour
{ {
public PlayerMove player; public float startmass;
public IceBlockPush ice;
//
// // Update is called once per frame
// void Update()
// {
// if (Input.GetKeyDown(KeyCode.Space))
// {
// player.Reset();
// ice.Reset();
// }
// }
private void OnTriggerEnter(Collider other) private void OnTriggerEnter(Collider other)
{ {
if (other.GetComponent<PlayerMove>()) if (other.isTrigger) return;
{ startmass = other.GetComponent<Rigidbody>().mass;
player.Reset(); other.GetComponent<Rigidbody>().mass = 100;
} other.GetComponent<Rigidbody>().mass = startmass;
else if(other.GetComponent<IceBlockPush>()) other.GetComponent<PositionReset>().Reset();
{
ice.Reset();
}
} }
} }
+50 -9
View File
@@ -1,17 +1,29 @@
using System; using System;
using System.Collections;
using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
public class PlayerMove : MonoBehaviour public class PlayerMove : MonoBehaviour
{ {
[SerializeField] private float basespeed;
[SerializeField] private float speed; [SerializeField] private float speed;
[SerializeField] private Rigidbody rb; [SerializeField] private float speedincrease;
[SerializeField] private Vector3 StartPos; [SerializeField] private float maxspeed;
private Rigidbody rb;
[SerializeField] private float slide;
Vector3 moveDirection;
bool vertical; bool vertical;
bool horizontal; private bool horizontal;
[SerializeField] private StandUpCollider standUp;
private void Start() private void Start()
{ {
rb = GetComponent<Rigidbody>(); rb = GetComponent<Rigidbody>();
standUp = FindAnyObjectByType(typeof(StandUpCollider)) as StandUpCollider;
} }
void Update() void Update()
@@ -21,26 +33,44 @@ public class PlayerMove : MonoBehaviour
horizontalInput = Mathf.Round(horizontalInput); horizontalInput = Mathf.Round(horizontalInput);
verticalInput = Mathf.Round(verticalInput); verticalInput = Mathf.Round(verticalInput);
Vector3 moveDirection;
if (horizontalInput != 0 && horizontal == true) if (horizontalInput != 0 && horizontal == true)
{ {
if (!standUp.ispushing)
{
transform.rotation = Quaternion.Euler(0f, 0f, 90f);
}
vertical = false; vertical = false;
moveDirection = new Vector3(horizontalInput,0, 0); moveDirection = new Vector3(horizontalInput,0, 0);
moveDirection.Normalize(); moveDirection.Normalize();
if (!vertical && speed <= maxspeed && !standUp.ispushing)
{
speed += speedincrease;
}
} }
else if (verticalInput != 0 && vertical == true) else if (verticalInput != 0 && vertical == true)
{ {
if (!standUp.ispushing)
{
transform.rotation = Quaternion.Euler(90f, 0f, 0f);
}
horizontal = false; horizontal = false;
moveDirection = new Vector3(0, 0, verticalInput); moveDirection = new Vector3(0, 0, verticalInput);
moveDirection.Normalize(); moveDirection.Normalize();
if (!horizontal && speed <= maxspeed && !standUp.ispushing)
{
speed += speedincrease;
}
} }
else else
{ {
moveDirection = new Vector3(0, 0, 0); StartCoroutine(Slide(slide));
horizontal = true; transform.rotation = Quaternion.Euler(0f, 0f, 0f);
vertical = true;
} }
@@ -48,8 +78,19 @@ public class PlayerMove : MonoBehaviour
transform.Translate(moveDirection * speed * Time.deltaTime, Space.World); transform.Translate(moveDirection * speed * Time.deltaTime, Space.World);
} }
public void Reset()
IEnumerator Slide(float delay)
{ {
this.transform.position = StartPos; yield return new WaitForSeconds(delay);
moveDirection = new Vector3(0, 0, 0);
horizontal = true;
vertical = true;
speed = basespeed;
} }
} }
+24
View File
@@ -0,0 +1,24 @@
using UnityEngine;
public class StandUpCollider : MonoBehaviour
{
public bool ispushing;
private void OnTriggerEnter(Collider other)
{
IceBlockPush block = other.gameObject.GetComponent<IceBlockPush>();
if (block != null)
{
ispushing = true;
}
}
private void OnTriggerExit(Collider other)
{
IceBlockPush block = other.gameObject.GetComponent<IceBlockPush>();
if (block != null)
{
ispushing = false;
}
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 19aae932aa4446c4788d84deb1116128
+11
View File
@@ -0,0 +1,11 @@
using UnityEngine;
public class PositionReset : MonoBehaviour
{
[SerializeField] private Vector3 StartPos;
public void Reset()
{
this.transform.position = StartPos;
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8fc662358fbf8394d804207b2a8c9868