commit 4a5cb87e4fb9e585bde16a0fc6e0715ca51422c4
parent 2e3dd30ffabf6e92e2d3eda51993ef6a6514ea11
Author: PlutoTank <qwolkensperg@gmail.com>
Date: Sat, 18 Apr 2020 02:16:52 -0400
allow for changing of orbital logic at run time
Diffstat:
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/Assets/Scripts/Slimecing/Swords/Orbitals/OrbitalLogicScripts/InputOrbitalLogic.cs b/Assets/Scripts/Slimecing/Swords/Orbitals/OrbitalLogicScripts/InputOrbitalLogic.cs
@@ -28,6 +28,8 @@ namespace Slimecing.Swords.Orbitals.OrbitalLogicScripts
public override void Initialize(GameObject owner, GameObject orbital)
{
+ _swordEllipse = new Ellipse(currentOrbitalStats.radiusX, currentOrbitalStats.radiusY);
+ _operatingOrbitalInputTrigger = Instantiate(orbitalInputTrigger);
GetInput(owner, orbital, Vector2.up);
GetInputAbilityActionType()?.ConfigureInput(owner);
}
diff --git a/Assets/Scripts/Slimecing/Swords/Orbitals/TakesOrbitals.cs b/Assets/Scripts/Slimecing/Swords/Orbitals/TakesOrbitals.cs
@@ -15,6 +15,7 @@ namespace Slimecing.Swords.Orbitals
private Collider _collider;
private List<GameObject> _spawnedOrbitalObjects = new List<GameObject>();
+ private List<OrbitalLogic> _spawnedOrbitalLogic = new List<OrbitalLogic>();
private void OnEnable()
{
@@ -58,9 +59,11 @@ namespace Slimecing.Swords.Orbitals
private void ResetSpawnedOrbitalObjects()
{
_spawnedOrbitalObjects = new List<GameObject>();
+ _spawnedOrbitalLogic = new List<OrbitalLogic>();
foreach (var t in orbitals)
{
_spawnedOrbitalObjects.Add(t.orbitalObject);
+ _spawnedOrbitalLogic.Add(t.currentOrbitalLogic);
}
}
@@ -142,7 +145,7 @@ namespace Slimecing.Swords.Orbitals
{
orbitals.Remove(orbitals[i]);
}
- if (orbitals[i].orbitalObject == _spawnedOrbitalObjects[i]) continue;
+ if (orbitals[i].orbitalObject == _spawnedOrbitalObjects[i] && orbitals[i].currentOrbitalLogic == _spawnedOrbitalLogic[i]) continue;
//DropOrbital(_spawnedOrbitalObjects[i]);
InitializeOrbital(orbitals[i]);
}