Made player launch when hit
Needs fixing
This commit is contained in:
@@ -134,6 +134,7 @@ GameObject:
|
||||
- component: {fileID: 104400497}
|
||||
- component: {fileID: 104400501}
|
||||
- component: {fileID: 104400500}
|
||||
- component: {fileID: 104400502}
|
||||
m_Layer: 0
|
||||
m_Name: Player
|
||||
m_TagString: Untagged
|
||||
@@ -158,8 +159,10 @@ MonoBehaviour:
|
||||
m_DistanceFromCentre: 0
|
||||
m_DistanceAlongRadius: 0
|
||||
m_ObjectRadius: 0
|
||||
m_IsAttachedToRings: 0
|
||||
m_Behaviour: {fileID: 0}
|
||||
m_SpinSpeed: 0
|
||||
m_Body: {fileID: 104400502}
|
||||
--- !u!4 &104400498
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -225,6 +228,33 @@ MeshFilter:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 104400496}
|
||||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!50 &104400502
|
||||
Rigidbody2D:
|
||||
serializedVersion: 4
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 104400496}
|
||||
m_BodyType: 0
|
||||
m_Simulated: 1
|
||||
m_UseFullKinematicContacts: 0
|
||||
m_UseAutoMass: 0
|
||||
m_Mass: 1
|
||||
m_LinearDrag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_GravityScale: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_Interpolate: 0
|
||||
m_SleepingMode: 1
|
||||
m_CollisionDetection: 0
|
||||
m_Constraints: 0
|
||||
--- !u!1 &519420028
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
@@ -8,6 +8,7 @@ using UnityEngine;
|
||||
public float m_DistanceFromCentre;
|
||||
public float m_DistanceAlongRadius;
|
||||
public float m_ObjectRadius = 0.1f;
|
||||
public bool m_IsAttachedToRings = true;
|
||||
|
||||
public OrbitalPositionBehaviour m_Behaviour;
|
||||
public readonly Transform m_Owner;
|
||||
@@ -84,9 +85,13 @@ public class GlobalOrbitalPositionManager : MonoBehaviour
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
yield return new WaitForFixedUpdate();
|
||||
s_Instance.m_PlayerOrbitalPosition.m_AttachedRing = s_Instance.m_LastGeneratedRing;
|
||||
|
||||
if (PlayerController.IsPlayerAttached)
|
||||
s_Instance.m_PlayerOrbitalPosition.m_AttachedRing = s_Instance.m_LastGeneratedRing;
|
||||
}
|
||||
|
||||
PlayerController.AttachPlayer();
|
||||
|
||||
yield return new WaitForSeconds(1.3f);
|
||||
AllowPlayerInput = true;
|
||||
s_Instance.m_LocalDeltaTimeScale = 1f;
|
||||
@@ -149,6 +154,9 @@ public class GlobalOrbitalPositionManager : MonoBehaviour
|
||||
|
||||
foreach (OrbitalPosition orbitalPosition in m_ObjectInstances)
|
||||
{
|
||||
if (!orbitalPosition.m_IsAttachedToRings)
|
||||
continue;
|
||||
|
||||
if (!m_Distances.ContainsKey(orbitalPosition.m_AttachedRing))
|
||||
{
|
||||
orbitalPosition.m_AttachedRing = m_LastGeneratedRing;
|
||||
|
||||
@@ -2,8 +2,16 @@ using UnityEngine;
|
||||
|
||||
public class PlayerController : OrbitalPositionBehaviour
|
||||
{
|
||||
private static PlayerController s_Instance;
|
||||
public static bool IsPlayerAttached => s_Instance.m_OrbitalPosition.m_IsAttachedToRings;
|
||||
public static void AttachPlayer() { s_Instance.m_OrbitalPosition.m_IsAttachedToRings = true; }
|
||||
|
||||
public Rigidbody2D m_Body;
|
||||
|
||||
protected override void OnStart()
|
||||
{
|
||||
s_Instance = this;
|
||||
|
||||
GlobalOrbitalPositionManager.SetPlayer(m_OrbitalPosition);
|
||||
|
||||
m_OrbitalPosition.m_ObjectRadius = 0.4f;
|
||||
@@ -20,7 +28,10 @@ public class PlayerController : OrbitalPositionBehaviour
|
||||
|
||||
public override void OnCollision(OrbitalPositionBehaviour other)
|
||||
{
|
||||
Debug.Log("HIT OBSTACLE IG");
|
||||
GlobalOrbitalPositionManager.RestartSimulation();
|
||||
|
||||
m_OrbitalPosition.m_IsAttachedToRings = false;
|
||||
m_Body.AddForce(Vector2.up * 6, ForceMode2D.Impulse);
|
||||
}
|
||||
|
||||
public override void OnReachCentre()
|
||||
|
||||
@@ -619,8 +619,10 @@ PlayerSettings:
|
||||
tvOS: UNITY_POST_PROCESSING_STACK_V2
|
||||
additionalCompilerArguments: {}
|
||||
platformArchitecture: {}
|
||||
scriptingBackend: {}
|
||||
il2cppCompilerConfiguration: {}
|
||||
scriptingBackend:
|
||||
Standalone: 0
|
||||
il2cppCompilerConfiguration:
|
||||
Standalone: 2
|
||||
il2cppCodeGeneration: {}
|
||||
managedStrippingLevel:
|
||||
EmbeddedLinux: 1
|
||||
|
||||
Reference in New Issue
Block a user