commit f3944ca658bd518b0e84c492a4325fa87b1673c0 parent 1de603549d6386c5b81310fd15af7a6fd44c5a9a Author: PlutoTank <qwolkensperg@gmail.com> Date: Thu, 23 Apr 2020 11:30:34 -0400 bug fix to orbital platform Diffstat:
3 files changed, 17 insertions(+), 8 deletions(-)
diff --git a/Assets/Scripts/Slimecing/Swords/Orbitals/ControllableByEventOrbital.cs b/Assets/Scripts/Slimecing/Swords/Orbitals/ControllableByEventOrbital.cs @@ -1,4 +1,5 @@ -using UnityEngine; +using System; +using UnityEngine; namespace Slimecing.Swords.Orbitals { @@ -10,6 +11,14 @@ namespace Slimecing.Swords.Orbitals private GameObject _oldOwner; private OrbitalLogic _oldOrbitalLogic; + private void OnEnable() + { + var orbital = ownerOfThisOrbital.GetOrbital(gameObject); + if (orbital == null) return; + _oldOwner = orbital.ownerControlObject; + _oldOrbitalLogic = orbital.currentOrbitalLogic; + } + public void SetOwnerOfThisOrbital(GameObject owner) { var orbital = ownerOfThisOrbital.GetOrbital(gameObject); @@ -23,6 +32,7 @@ namespace Slimecing.Swords.Orbitals public void UnSetOwnerOfThisOrbital() { + if (_oldOwner == null || _oldOrbitalLogic == null) return; var orbital = ownerOfThisOrbital.GetOrbital(gameObject); if (orbital == null) return; orbital.ownerControlObject = _oldOwner; diff --git a/Assets/Scripts/Slimecing/Swords/Orbitals/SOOrbitalLogic/TimerOrbitalLogic.asset b/Assets/Scripts/Slimecing/Swords/Orbitals/SOOrbitalLogic/TimerOrbitalLogic.asset @@ -12,6 +12,5 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: a01e1cbc5c4e6e7418ba67b90bf0fce4, type: 3} m_Name: TimerOrbitalLogic m_EditorClassIdentifier: - orbitalStats: {fileID: 11400000, guid: ca7798574e6d9ea4aaf5df7ed0081254, type: 2} - randomProgress: 1 - orbitalProgress: 0.83612007 + randomProgress: 0 + startOrbitalProgress: 0 diff --git a/Assets/_Scenes/Testing/SLope.unity b/Assets/_Scenes/Testing/SLope.unity @@ -2955,10 +2955,10 @@ MonoBehaviour: - controlOwner: {fileID: 1244540587} orbital: {fileID: 1469247986} orbitalLogic: {fileID: 11400000, guid: f604a09f73d9b3e4a8d515810e94c6d9, type: 2} - orbitalSpeed: 5 + orbitalSpeed: 4 yOffset: 1 - xAxis: 10 - yAxis: 10 + xAxis: 8 + yAxis: 8 sticky: 0 instantiateOnSpawn: 0 --- !u!135 &1244540589 @@ -3523,7 +3523,7 @@ Transform: m_GameObject: {fileID: 1469247986} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 10.110001, y: 0.710001, z: 0.6} - m_LocalScale: {x: 6.499345, y: 0.54524815, z: 16.497879} + m_LocalScale: {x: 6.499345, y: 0.54524815, z: 9.705867} m_Children: [] m_Father: {fileID: 1244540592} m_RootOrder: 0