Converted Toggle State to a Submodule
This commit is contained in:
parent
364fc6b935
commit
2ac0a1c606
|
@ -0,0 +1,3 @@
|
||||||
|
[submodule "ToggleState"]
|
||||||
|
path = ToggleState
|
||||||
|
url = git@git.syntriax.com:Syntriax/ToggleState.git
|
|
@ -1,5 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using Syntriax.Modules.Movement.State;
|
using Syntriax.Modules.ToggleState;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Syntriax.Modules.Movement
|
namespace Syntriax.Modules.Movement
|
||||||
|
@ -39,7 +39,7 @@ namespace Syntriax.Modules.Movement
|
||||||
|
|
||||||
protected virtual void Start()
|
protected virtual void Start()
|
||||||
{
|
{
|
||||||
toggleState = GetComponent<ToggleState>();
|
toggleState = GetComponent<IToggleState>();
|
||||||
movementController = GetComponent<IMovementController>();
|
movementController = GetComponent<IMovementController>();
|
||||||
|
|
||||||
movementController.OnMovementActivated += OnActivated;
|
movementController.OnMovementActivated += OnActivated;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Syntriax.Modules.Movement.State;
|
using Syntriax.Modules.ToggleState;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Syntriax.Modules.Movement
|
namespace Syntriax.Modules.Movement
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Syntriax.Modules.Movement.State
|
|
||||||
{
|
|
||||||
public interface IToggleState
|
|
||||||
{
|
|
||||||
bool Toggled { get; set; }
|
|
||||||
Action<bool> OnToggleStateChanged { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 174255e0fce0b3a4e8b5e34afa96ffd3
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,25 +0,0 @@
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Syntriax.Modules.Movement.State
|
|
||||||
{
|
|
||||||
public class MemberToggleState : IToggleState
|
|
||||||
{
|
|
||||||
private bool _enabled = true;
|
|
||||||
|
|
||||||
public bool Toggled
|
|
||||||
{
|
|
||||||
get => _enabled;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
bool isNewValue = _enabled != value;
|
|
||||||
|
|
||||||
_enabled = value;
|
|
||||||
|
|
||||||
if (isNewValue)
|
|
||||||
OnToggleStateChanged.Invoke(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action<bool> OnToggleStateChanged { get; set; } = null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 7e03986725a3747459e11540e8915a56
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -1,25 +0,0 @@
|
||||||
using System;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace Syntriax.Modules.Movement.State
|
|
||||||
{
|
|
||||||
public class ToggleState : MonoBehaviour, IToggleState
|
|
||||||
{
|
|
||||||
private bool _enabled = true;
|
|
||||||
public bool Toggled
|
|
||||||
{
|
|
||||||
get => _enabled;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
bool isNewValue = _enabled != value;
|
|
||||||
|
|
||||||
_enabled = value;
|
|
||||||
|
|
||||||
if (isNewValue)
|
|
||||||
OnToggleStateChanged.Invoke(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Action<bool> OnToggleStateChanged { get; set; } = null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,11 +0,0 @@
|
||||||
fileFormatVersion: 2
|
|
||||||
guid: 7ed1257e4c3c70343bdc02d2e01a95d6
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
|
@ -2,7 +2,8 @@
|
||||||
"name": "Syntriax.Modules.Movement",
|
"name": "Syntriax.Modules.Movement",
|
||||||
"rootNamespace": "",
|
"rootNamespace": "",
|
||||||
"references": [
|
"references": [
|
||||||
"GUID:75469ad4d38634e559750d17036d5f7c"
|
"GUID:75469ad4d38634e559750d17036d5f7c",
|
||||||
|
"GUID:efa9a9bc94c60c74684aafb7428fbf61"
|
||||||
],
|
],
|
||||||
"includePlatforms": [],
|
"includePlatforms": [],
|
||||||
"excludePlatforms": [],
|
"excludePlatforms": [],
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit a6e6babce9d2a6911b0b53049727f213234e4e03
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: e5f744b49d70a8d418f1bc6fd0c128fa
|
guid: 461182bc375cc354bbb3e45db52bdf3f
|
||||||
folderAsset: yes
|
folderAsset: yes
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
Loading…
Reference in New Issue