9 Commits

Author SHA1 Message Date
jlink 7d6579dce7 Pingu Art und Bear mechanic 2026-01-24 18:01:20 +01:00
jlink a6c4d0ba5b penguin implementierung 2026-01-24 15:38:05 +01:00
jlink a348f3c6a4 Local Multiplayer 2026-01-24 15:00:22 +01:00
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
43 changed files with 2277 additions and 64 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:
Binary file not shown.
Binary file not shown.
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4b37e6f7170b25c4db6a0c78dfa46e57
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+137
View File
@@ -0,0 +1,137 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Ice
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap:
RenderType: Opaque
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _XRMotionVectorsPass: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 0.37486652, g: 0.8441055, b: 0.9811321, a: 1}
- _Color: {r: 0.3748665, g: 0.8441055, b: 0.9811321, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &2741026907837304031
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
version: 10
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ee4d96d7f508e9444af762136e9c6e5c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e055c8f81d5bb87429176f3634717f05
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+137
View File
@@ -0,0 +1,137 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Penguin
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap:
RenderType: Opaque
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: 0cb99b4457363fe448ba37ceb61821ba, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 0cb99b4457363fe448ba37ceb61821ba, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _XRMotionVectorsPass: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &2636418254405507475
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.RenderPipelines.Universal.Editor::UnityEditor.Rendering.Universal.AssetVersion
version: 10
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b4e93230cf8b48c4a84b58b041637280
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.
+115
View File
@@ -0,0 +1,115 @@
fileFormatVersion: 2
guid: 32969bda2a2b4fc4aaf0976c60efc61d
ModelImporter:
serializedVersion: 24200
internalIDToNameTable: []
externalObjects:
- first:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: Material
second: {fileID: 2100000, guid: b4e93230cf8b48c4a84b58b041637280, type: 2}
materials:
materialImportMode: 2
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
removeConstantScaleCurves: 0
motionNodeName:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importPhysicalCameras: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
nodeNameCollisionStrategy: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
bakeAxisConversion: 0
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
optimizeBones: 1
generateMeshLods: 0
meshLodGenerationFlags: 0
maximumMeshLod: -1
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVMarginMethod: 1
secondaryUVMinLightmapResolution: 40
secondaryUVMinObjectScale: 1
secondaryUVPackMargin: 4
useFileScale: 1
strictVertexDataChecks: 0
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
addHumanoidExtraRootOnlyWhenUsingAvatar: 1
importBlendShapeDeformPercent: 1
remapMaterialsIfMaterialImportModeIsNone: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:
Binary file not shown.

After

Width:  |  Height:  |  Size: 877 KiB

+130
View File
@@ -0,0 +1,130 @@
fileFormatVersion: 2
guid: 0cb99b4457363fe448ba37ceb61821ba
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:
File diff suppressed because it is too large Load Diff
+68
View File
@@ -0,0 +1,68 @@
using System;
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
public class BearAwareness : MonoBehaviour
{
private int awareness;
public Slider awarenessSlider;
public Image SilderColor;
public static event Action<float> HasWokenUp;
public float timeToWakeUp = 2f;
// Start is called once before the first execution of Update after the MonoBehaviour is created
void Start()
{
awareness = 0;
awarenessSlider.value = 0;
Noice.OnMakeNoice += IncreaseAwareness;
StartCoroutine(Decrease(10));
}
private void Update()
{
if (awareness >= (awarenessSlider.maxValue - 10))
{
SilderColor.color = Color.red;
}
else if (awareness >= (awarenessSlider.maxValue / 2))
{
SilderColor.color = Color.orange;
}
else if (awareness <= (awarenessSlider.maxValue / 2) )
{
SilderColor.color = Color.darkGreen;
}
}
void IncreaseAwareness(int noice)
{
awareness += noice;
awarenessSlider.value = awareness;
if (awareness >= awarenessSlider.maxValue)
{
Debug.Log("Bear is awake now!");
HasWokenUp.Invoke(timeToWakeUp);
}
}
IEnumerator Decrease(float delay)
{
while (true)
{
yield return new WaitForSeconds(5);
awarenessSlider.value -= 5;
}
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 9d065ef101ba1aa4287712ed4364f254
+45
View File
@@ -0,0 +1,45 @@
using System;
using System.Collections;
using UnityEngine;
public class BearIsAwake : MonoBehaviour
{
public Transform Penguin;
private void Start()
{
BearAwareness.HasWokenUp += IsAwake;
}
public void IsAwake(float time)
{
StartCoroutine(SleepIsOver(time));
}
IEnumerator SleepIsOver(float time)
{
yield return new WaitForSeconds(time);
Vector3 direction = Penguin.position - transform.position;
float distance = direction.magnitude;
direction.Normalize(); // Wichtig: Raycast braucht eine normierte Richtung
if (Physics.Raycast(transform.position, direction, out RaycastHit hit, distance))
{
Debug.Log("Getroffen: " + hit.collider.name);
if (hit.collider.name == "StandUpCollider")
{
Debug.Log("Your Dead!");
}
else
{
Debug.Log("What?");
}
}
Debug.DrawLine(transform.position, Penguin.position, Color.red, 10f);
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 682ff406ef701fc47849b6c2a3e3473e
-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;
}
} }
+14
View File
@@ -0,0 +1,14 @@
using Unity.VisualScripting;
using UnityEngine;
using System;
public class Noice : MonoBehaviour
{
public static event Action<int> OnMakeNoice;
public int noice;
private void OnTriggerEnter(Collider other)
{
if (other.isTrigger) return;
OnMakeNoice.Invoke(noice);
}
}
+2
View File
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: e7bd60a7c0041e044b3f3b515418222e
+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();
}
} }
} }
+58 -17
View File
@@ -1,55 +1,96 @@
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] StandUpCollider standUp;
[SerializeField] private string inputNameHorizontal;
[SerializeField] private string inputNameVertical;
private void Start() private void Start()
{ {
rb = GetComponent<Rigidbody>(); rb = GetComponent<Rigidbody>();
standUp = GetComponentInChildren<StandUpCollider>();
} }
void Update() void Update()
{ {
float horizontalInput = Input.GetAxis("Horizontal"); float horizontalInput = Input.GetAxis(inputNameHorizontal);
float verticalInput = Input.GetAxis("Vertical"); float verticalInput = Input.GetAxis(inputNameVertical);
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;
} }
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
+71 -6
View File
@@ -6,11 +6,11 @@ InputManager:
serializedVersion: 2 serializedVersion: 2
m_Axes: m_Axes:
- serializedVersion: 3 - serializedVersion: 3
m_Name: Horizontal m_Name: Horizontal 1
descriptiveName: descriptiveName:
descriptiveNegativeName: descriptiveNegativeName:
negativeButton: left negativeButton:
positiveButton: right positiveButton:
altNegativeButton: a altNegativeButton: a
altPositiveButton: d altPositiveButton: d
gravity: 3 gravity: 3
@@ -22,13 +22,77 @@ InputManager:
axis: 0 axis: 0
joyNum: 0 joyNum: 0
- serializedVersion: 3 - serializedVersion: 3
m_Name: Vertical m_Name: Horizontal 2
descriptiveName:
descriptiveNegativeName:
negativeButton: left
positiveButton: right
altNegativeButton:
altPositiveButton:
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Horizontal 3
descriptiveName:
descriptiveNegativeName:
negativeButton: h
positiveButton: k
altNegativeButton:
altPositiveButton:
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Vertical 1
descriptiveName:
descriptiveNegativeName:
negativeButton:
positiveButton:
altNegativeButton: s
altPositiveButton: w
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Vertical 2
descriptiveName: descriptiveName:
descriptiveNegativeName: descriptiveNegativeName:
negativeButton: down negativeButton: down
positiveButton: up positiveButton: up
altNegativeButton: s altNegativeButton:
altPositiveButton: w altPositiveButton:
gravity: 3
dead: 0.001
sensitivity: 3
snap: 1
invert: 0
type: 0
axis: 0
joyNum: 0
- serializedVersion: 3
m_Name: Vertical 3
descriptiveName:
descriptiveNegativeName:
negativeButton: j
positiveButton: u
altNegativeButton:
altPositiveButton:
gravity: 3 gravity: 3
dead: 0.001 dead: 0.001
sensitivity: 3 sensitivity: 3
@@ -485,3 +549,4 @@ InputManager:
type: 2 type: 2
axis: 5 axis: 5
joyNum: 0 joyNum: 0
m_UsePhysicalKeys: 1
+1 -1
View File
@@ -12,7 +12,7 @@ TagManager:
- -
- Water - Water
- UI - UI
- - Player
- -
- -
- -