Final touches

This commit is contained in:
Pasha Bibko
2025-04-28 10:16:14 +01:00
parent 16bcb9b203
commit f4d15f33e7
12 changed files with 1719 additions and 675 deletions

83
Assets/New Material.mat Normal file
View File

@@ -0,0 +1,83 @@
%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: New Material
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _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}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0, g: 1, b: 0.029119253, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 09636b3a98c7a844eb4438d5e18a2346
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -75,6 +75,173 @@ MonoBehaviour:
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &2567258029979818048
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6793247590988510300}
- component: {fileID: 4215272941060588095}
- component: {fileID: 7396474193888481675}
m_Layer: 5
m_Name: Speed (1)
m_TagString: NoTag
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6793247590988510300
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2567258029979818048}
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: 5671584535948009389}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 100, y: -100}
m_SizeDelta: {x: 160, y: 150}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &4215272941060588095
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2567258029979818048}
m_CullTransparentMesh: 1
--- !u!114 &7396474193888481675
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2567258029979818048}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: 'Controls:
WASD - Move
LSHIFT - Wall Run (Red Walls)
SPACE
- Jump'
--- !u!1 &5244928208465755154
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6414998190209660209}
- component: {fileID: 3397843830819786604}
- component: {fileID: 5086944111385116840}
m_Layer: 5
m_Name: Speed (2)
m_TagString: NoTag
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6414998190209660209
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5244928208465755154}
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: 5671584535948009389}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 100, y: 100}
m_SizeDelta: {x: 160, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3397843830819786604
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5244928208465755154}
m_CullTransparentMesh: 1
--- !u!114 &5086944111385116840
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5244928208465755154}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 0
m_MaxSize: 40
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: 'Goal:
Get to the green wall as fast as possible'
--- !u!1 &5857485381795871981
GameObject:
m_ObjectHideFlags: 0
@@ -186,6 +353,8 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3955103952048326661}
- {fileID: 6793247590988510300}
- {fileID: 6414998190209660209}
- {fileID: 2457658704519817442}
- {fileID: 232158275427744802}
m_Father: {fileID: 0}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class KillPlayerOnCollision : MonoBehaviour
{
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Player"))
{
PlayerMovement.Instance().Kill();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f2fde010c43e15d4893fce8d399cb999
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -49,6 +49,12 @@ public class CameraController : MonoBehaviour
// Update is called once per frame
void Update()
{
if (PlayerMovement.Instance().IsDead())
{
transform.position = m_Tracking.position;
return;
}
// Gets the mouse input from the user
Vector2 mouse = new Vector2
(

View File

@@ -4,6 +4,22 @@ public partial class PlayerMovement : MonoBehaviour
{
private void OnTriggerStay(Collider other)
{
if (m_IsDead)
{
return;
}
if (other.CompareTag("Finish"))
{
m_IsDead = true;
m_GameCanvas.enabled = false;
m_CompletedCanvas.enabled = true;
float timeTaken = Time.time - m_StartTime;
m_CompletedText.text = "Congratulations you beat 'The Mobius Line'\nYou took " + timeTaken.ToString("0.00") + " seconds\nPress R to restart and try to get a faster time";
}
// Stops it trying to find the normals of portals
if (other.CompareTag("Portal")) { return; }

View File

@@ -22,6 +22,11 @@ public partial class PlayerMovement : MonoBehaviour
// Fixed Update is called once per physics update
private void FixedUpdate()
{
if (m_IsDead)
{
return;
}
// Resets portal state
m_PortalFrameCounter = Mathf.Max(0, m_PortalFrameCounter - 1);

View File

@@ -41,6 +41,12 @@ public partial class PlayerMovement : MonoBehaviour
[SerializeField] Transform m_Orientation;
[SerializeField] Transform m_PlayerTransform;
[Header("Canvases")]
[SerializeField] Canvas m_GameCanvas;
[SerializeField] Canvas m_DeadCanvas;
[SerializeField] Canvas m_CompletedCanvas;
[SerializeField] Text m_CompletedText;
[Header("Debug Settings")]
[SerializeField] Text m_SpeedDisplay;
@@ -85,6 +91,10 @@ public partial class PlayerMovement : MonoBehaviour
//
int m_PortalFrameCounter = 0;
bool m_IsDead = false;
float m_StartTime;
// Only instance of the player
static PlayerMovement s_Instance;
@@ -98,6 +108,12 @@ public partial class PlayerMovement : MonoBehaviour
// Start is called before the first frame update
private void Start()
{
m_StartTime = Time.time;
//
m_CompletedCanvas.enabled = false;
m_DeadCanvas.enabled = false;
// Checks there is not more than one player at one time
if (s_Instance != null)
{
@@ -121,4 +137,19 @@ public partial class PlayerMovement : MonoBehaviour
// Allocates memory for the list of collisions
m_WallCollisions = new List<Collider>();
}
public void Kill()
{
if (m_IsDead)
{
return;
}
m_IsDead = true;
m_GameCanvas.enabled = false;
m_DeadCanvas.enabled = true;
}
public bool IsDead() { return m_IsDead; }
}

View File

@@ -45,6 +45,17 @@ public partial class PlayerMovement : MonoBehaviour
// Update is called once per frame
private void Update()
{
// Reloads the game to stop falling off
if (Input.GetKey(KeyCode.R))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
if (m_IsDead)
{
return;
}
// Performs raycasts to see what the player is standing on
m_Grounded = Physics.Raycast(transform.position, Vector3.down, out m_StandingOn, m_PlayerHeight * 0.5f + 0.3f, m_GroundMask);
m_OnSlope = m_StandingOn.normal != new Vector3(0.0f, 1.0f, 0.0f) && m_Grounded;
@@ -60,11 +71,5 @@ public partial class PlayerMovement : MonoBehaviour
// Displays the speed of the player to the screen
m_SpeedDisplay.text = new Vector3(m_Body.velocity.x, 0.0f, m_Body.velocity.z).magnitude.ToString("0.00") + " m/s";
// Reloads the game to stop falling off
if (Input.GetKey(KeyCode.R))
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
}
}

View File

@@ -144,7 +144,7 @@
{
"type": "UnityEngine.ProBuilder.SelectMode, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",
"key": "editor.lastMeshSelectMode",
"value": "{\"m_Value\":8}"
"value": "{\"m_Value\":4}"
},
{
"type": "UnityEngine.ProBuilder.SelectionModifierBehavior, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null",