commit 1de603549d6386c5b81310fd15af7a6fd44c5a9a parent 6ce9f0c1e7ac24c2cada93a28e7ec0dba2002935 Author: PlutoTank <qwolkensperg@gmail.com> Date: Thu, 23 Apr 2020 11:09:51 -0400 added some extra orbital parts Diffstat:
10 files changed, 136 insertions(+), 0 deletions(-)
diff --git a/Assets/Scripts/Slimecing/SOEventSystem/SOEvents/TestEvents.meta b/Assets/Scripts/Slimecing/SOEventSystem/SOEvents/TestEvents.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7ff3579c635a4764f9d4ab0607fa7783 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Slimecing/SOEventSystem/SOEvents/TestEvents/GameEvent_OrbitalTestChanger.asset b/Assets/Scripts/Slimecing/SOEventSystem/SOEvents/TestEvents/GameEvent_OrbitalTestChanger.asset @@ -0,0 +1,14 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 00209251ddb44e60b1e5818f1a1681f2, type: 3} + m_Name: GameEvent_OrbitalTestChanger + m_EditorClassIdentifier: diff --git a/Assets/Scripts/Slimecing/SOEventSystem/SOEvents/TestEvents/GameEvent_OrbitalTestChanger.asset.meta b/Assets/Scripts/Slimecing/SOEventSystem/SOEvents/TestEvents/GameEvent_OrbitalTestChanger.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fdc607aa50c05f348bc9b3893c862523 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Slimecing/SOEventSystem/SOEvents/TestEvents/GameEvent_OrbitalTestChangerDeactivate.asset b/Assets/Scripts/Slimecing/SOEventSystem/SOEvents/TestEvents/GameEvent_OrbitalTestChangerDeactivate.asset @@ -0,0 +1,14 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 00209251ddb44e60b1e5818f1a1681f2, type: 3} + m_Name: GameEvent_OrbitalTestChangerDeactivate + m_EditorClassIdentifier: diff --git a/Assets/Scripts/Slimecing/SOEventSystem/SOEvents/TestEvents/GameEvent_OrbitalTestChangerDeactivate.asset.meta b/Assets/Scripts/Slimecing/SOEventSystem/SOEvents/TestEvents/GameEvent_OrbitalTestChangerDeactivate.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 6900e96419897bb45a5ea790f7790d84 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Slimecing/Swords/Orbitals/ControllableByEventOrbital.cs b/Assets/Scripts/Slimecing/Swords/Orbitals/ControllableByEventOrbital.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace Slimecing.Swords.Orbitals +{ + public class ControllableByEventOrbital : MonoBehaviour + { + [SerializeField] private TakesOrbitals ownerOfThisOrbital; + [SerializeField] private OrbitalLogic orbitalLogicToSetTo; + + private GameObject _oldOwner; + private OrbitalLogic _oldOrbitalLogic; + + public void SetOwnerOfThisOrbital(GameObject owner) + { + var orbital = ownerOfThisOrbital.GetOrbital(gameObject); + if (orbital == null) return; + _oldOwner = orbital.ownerControlObject; + _oldOrbitalLogic = orbital.currentOrbitalLogic; + orbital.ownerControlObject = owner; + orbital.currentOrbitalLogic = orbitalLogicToSetTo; + orbital.Initialize(orbital.ownerObject); + } + + public void UnSetOwnerOfThisOrbital() + { + var orbital = ownerOfThisOrbital.GetOrbital(gameObject); + if (orbital == null) return; + orbital.ownerControlObject = _oldOwner; + orbital.currentOrbitalLogic = _oldOrbitalLogic; + orbital.Initialize(orbital.ownerObject); + } + } +} diff --git a/Assets/Scripts/Slimecing/Swords/Orbitals/ControllableByEventOrbital.cs.meta b/Assets/Scripts/Slimecing/Swords/Orbitals/ControllableByEventOrbital.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 59f1329b9d578ad4d9b8d6d5d290f667 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/Slimecing/Swords/Orbitals/IControllableOrbital.cs b/Assets/Scripts/Slimecing/Swords/Orbitals/IControllableOrbital.cs @@ -0,0 +1,9 @@ +using UnityEngine; + +namespace Slimecing.Swords.Orbitals +{ + public interface IControllableOrbital + { + void ChangeController(GameObject controller); + } +} diff --git a/Assets/Scripts/Slimecing/TestScripts/CheckPlayerCollisionExtensionMethod.cs b/Assets/Scripts/Slimecing/TestScripts/CheckPlayerCollisionExtensionMethod.cs @@ -0,0 +1,13 @@ +using Slimecing.Characters; +using UnityEngine; + +namespace Slimecing.TestScripts +{ + public static class CheckPlayerCollisionExtensionMethod + { + public static bool ColIsPlayer(this Collision col) + { + return col.gameObject.GetComponent<CharacterMovementController>() != null; + } + } +} diff --git a/Assets/Scripts/Slimecing/TestScripts/OrbitalInputChangerSwitch.cs b/Assets/Scripts/Slimecing/TestScripts/OrbitalInputChangerSwitch.cs @@ -0,0 +1,18 @@ +using Slimecing.SOEventSystem.Events; +using UnityEngine; + +namespace Slimecing.TestScripts +{ + public class OrbitalInputChangerSwitch : MonoBehaviour + { + [SerializeField] private GameObjectEvent onCollisionEvent; + + private void OnCollisionEnter(Collision other) + { + if (other.ColIsPlayer()) + { + onCollisionEvent.Raise(other.gameObject); + } + } + } +}