mirror of
https://github.com/PashaBibko/The-Mobius-Line.git
synced 2026-04-03 17:39:03 +00:00
Did suff
This commit is contained in:
@@ -215,7 +215,7 @@ Transform:
|
||||
m_GameObject: {fileID: 4525855263416128436}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
|
||||
m_LocalPosition: {x: 0, y: 5, z: -0.1}
|
||||
m_LocalPosition: {x: 0, y: 5, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
@@ -317,6 +317,7 @@ GameObject:
|
||||
m_Component:
|
||||
- component: {fileID: 8290014685027761188}
|
||||
- component: {fileID: 4196137517685965440}
|
||||
- component: {fileID: 848597767875800347}
|
||||
m_Layer: 0
|
||||
m_Name: Back
|
||||
m_TagString: Untagged
|
||||
@@ -360,3 +361,16 @@ BoxCollider:
|
||||
serializedVersion: 3
|
||||
m_Size: {x: 10, y: 10, z: 5}
|
||||
m_Center: {x: 0, y: 5, z: -3.5}
|
||||
--- !u!114 &848597767875800347
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7967144210440699741}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 859e4c4c9b11c654a8ab3891fbd8c5b3, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Manager: {fileID: 4470023418895194988}
|
||||
|
||||
@@ -110,7 +110,7 @@ Camera:
|
||||
width: 1
|
||||
height: 1
|
||||
near clip plane: 0.3
|
||||
far clip plane: 100
|
||||
far clip plane: 500
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
|
||||
@@ -78,6 +78,6 @@ Material:
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 0, b: 0, a: 1}
|
||||
- _Color: {r: 0, g: 0, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -4500,7 +4500,7 @@ MonoBehaviour:
|
||||
m_LineSpacing: 1
|
||||
m_Text: 'Note:
|
||||
|
||||
Only works on red walls'
|
||||
Only works on BLUE walls'
|
||||
--- !u!222 &1529889363
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -8,6 +8,10 @@ public class GravityController
|
||||
// Constant gravity scale
|
||||
const float m_GravityScale = -20.0f;
|
||||
|
||||
Vector3 m_Up = Vector3.zero;
|
||||
|
||||
public static Vector3 up => s_Instance.m_Up;
|
||||
|
||||
// Private constructor to stop accidental creation
|
||||
private GravityController() { }
|
||||
|
||||
@@ -27,5 +31,6 @@ public class GravityController
|
||||
{
|
||||
// Sets the gravity
|
||||
Physics.gravity = new Vector3(0, m_GravityScale * scale, 0);
|
||||
m_Up = Physics.gravity;
|
||||
}
|
||||
}
|
||||
|
||||
10
Assets/Scripts/Portals/PortalBack.cs
Normal file
10
Assets/Scripts/Portals/PortalBack.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PortalBack : MonoBehaviour
|
||||
{
|
||||
[SerializeField] PortalManager m_Manager;
|
||||
|
||||
// private void OnCollisionEnter(Collision collision) => m_Manager.ForceTeleport();
|
||||
}
|
||||
11
Assets/Scripts/Portals/PortalBack.cs.meta
Normal file
11
Assets/Scripts/Portals/PortalBack.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 859e4c4c9b11c654a8ab3891fbd8c5b3
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -18,7 +18,7 @@ public class PortalManager : MonoBehaviour
|
||||
// Private variables //
|
||||
|
||||
PortalManager m_OtherManager;
|
||||
PortalCamera m_PortalCamera;
|
||||
[SerializeField] PortalCamera m_PortalCamera;
|
||||
|
||||
// Gets the other end of the portal
|
||||
public PortalManager Linked() => m_OtherManager;
|
||||
@@ -52,6 +52,23 @@ public class PortalManager : MonoBehaviour
|
||||
m_PlayerPoint.position = CameraController.Instance().transform.position;
|
||||
}
|
||||
|
||||
public void ForceTeleport()
|
||||
{
|
||||
// Calculates if the player is going towards the portal
|
||||
Vector3 difference = PlayerMovement.Pos() - transform.position;
|
||||
|
||||
// Rotates the player
|
||||
float rotDif = -Quaternion.Angle(transform.rotation, m_OtherManager.transform.rotation) + m_AngleDif;
|
||||
CameraController.Instance().RotatePlayerDirection(new Vector2(0f, rotDif));
|
||||
|
||||
// Tellss the player it went through a portal
|
||||
PlayerMovement.Instance().WentThroughPortal(rotDif);
|
||||
|
||||
// Teleports the player
|
||||
Vector3 offset = Quaternion.Euler(0f, rotDif, 0f) * difference;
|
||||
PlayerMovement.SetPos(m_OtherManager.transform.position + offset - new Vector3(0, 1.0f, 0));
|
||||
}
|
||||
|
||||
// When something enters the portal
|
||||
private void OnTriggerEnter(Collider other)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user