From 06eb63d3a92df2857676c57ef84f8dc5e1fd76b1 Mon Sep 17 00:00:00 2001 From: haitem Date: Sat, 29 Jan 2022 17:06:48 +0100 Subject: [PATCH] Edit player controller --- Assets/Scripts/PlayerController.cs | 50 +++++++++++++++------------ UserSettings/EditorUserSettings.asset | 9 ++--- 2 files changed, 30 insertions(+), 29 deletions(-) diff --git a/Assets/Scripts/PlayerController.cs b/Assets/Scripts/PlayerController.cs index f16bf18..adaa771 100644 --- a/Assets/Scripts/PlayerController.cs +++ b/Assets/Scripts/PlayerController.cs @@ -168,29 +168,33 @@ public class PlayerController : MonoBehaviour Vector3 gDirection; PlatformManager platform = other.gameObject.GetComponent(); gDirection = -other.GetContact(0).normal; - switch (platform.type) - { - case PlatformManager.PlatformType.Push: - break; - case PlatformManager.PlatformType.Pull: - break; - case PlatformManager.PlatformType.RotateY: - break; - case PlatformManager.PlatformType.RotateZ: - break; - case PlatformManager.PlatformType.SpeedUp: - modifier += platform.speed; - break; - case PlatformManager.PlatformType.SpeedDown: - if (modifier - platform.speed >= 0) { - modifier -= platform.speed; - } else { - modifier = 0.0f; - } - break; - default: - gDirection = -transform.up; - break; + if (platform != null) { + switch (platform.type) + { + case PlatformManager.PlatformType.Push: + break; + case PlatformManager.PlatformType.Pull: + break; + case PlatformManager.PlatformType.RotateY: + break; + case PlatformManager.PlatformType.RotateZ: + break; + case PlatformManager.PlatformType.SpeedUp: + modifier += platform.speed; + break; + case PlatformManager.PlatformType.SpeedDown: + if (modifier - platform.speed >= 0) { + modifier -= platform.speed; + } else { + modifier = 0.0f; + } + break; + default: + gDirection = -transform.up; + break; + } + } else { + gDirection = -transform.up; } platformForward = other.transform.forward; this.downDirection = gDirection; diff --git a/UserSettings/EditorUserSettings.asset b/UserSettings/EditorUserSettings.asset index 966ab0b..43f28cf 100644 --- a/UserSettings/EditorUserSettings.asset +++ b/UserSettings/EditorUserSettings.asset @@ -6,16 +6,13 @@ EditorUserSettings: serializedVersion: 4 m_ConfigSettings: RecentlyUsedSceneGuid-0: - value: 50080c5756540a5e095b0d7a11210644154f1b7f782922642f281b35b0b86c6d + value: 5150040003515f5f585f552011755e4446154e2e2a2a7e347c2c4965b1b4366a flags: 0 RecentlyUsedSceneGuid-1: - value: 5a5757560101590a5d0c0e24427b5d44434e4c7a7b7a23677f2b4565b7b5353a - flags: 0 - RecentlyUsedSceneGuid-2: value: 5b53500307070b0b0b0f5a2648735a4412154f737d2b2536782f1e32e0b86c3a flags: 0 - RecentlyUsedSceneGuid-3: - value: 5150040003515f5f585f552011755e4446154e2e2a2a7e347c2c4965b1b4366a + RecentlyUsedSceneGuid-2: + value: 5a5757560101590a5d0c0e24427b5d44434e4c7a7b7a23677f2b4565b7b5353a flags: 0 RecentlyUsedScenePath-0: value: 22424703114646680e0b0227036c6c111b07142f1f2b233e2867083debf42d