Converted Toggle State to a Submodule

This commit is contained in:
Syntriax 2022-11-14 13:04:09 +03:00
parent 364fc6b935
commit 2ac0a1c606
12 changed files with 10 additions and 98 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "ToggleState"]
path = ToggleState
url = git@git.syntriax.com:Syntriax/ToggleState.git

View File

@ -1,5 +1,5 @@
using System;
using Syntriax.Modules.Movement.State;
using Syntriax.Modules.ToggleState;
using UnityEngine;
namespace Syntriax.Modules.Movement
@ -39,7 +39,7 @@ namespace Syntriax.Modules.Movement
protected virtual void Start()
{
toggleState = GetComponent<ToggleState>();
toggleState = GetComponent<IToggleState>();
movementController = GetComponent<IMovementController>();
movementController.OnMovementActivated += OnActivated;

View File

@ -1,6 +1,6 @@
using System;
using System.Collections.Generic;
using Syntriax.Modules.Movement.State;
using Syntriax.Modules.ToggleState;
using UnityEngine;
namespace Syntriax.Modules.Movement

View File

@ -1,10 +0,0 @@
using System;
namespace Syntriax.Modules.Movement.State
{
public interface IToggleState
{
bool Toggled { get; set; }
Action<bool> OnToggleStateChanged { get; set; }
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 174255e0fce0b3a4e8b5e34afa96ffd3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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;
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7e03986725a3747459e11540e8915a56
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -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;
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7ed1257e4c3c70343bdc02d2e01a95d6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -2,7 +2,8 @@
"name": "Syntriax.Modules.Movement",
"rootNamespace": "",
"references": [
"GUID:75469ad4d38634e559750d17036d5f7c"
"GUID:75469ad4d38634e559750d17036d5f7c",
"GUID:efa9a9bc94c60c74684aafb7428fbf61"
],
"includePlatforms": [],
"excludePlatforms": [],

1
ToggleState Submodule

@ -0,0 +1 @@
Subproject commit a6e6babce9d2a6911b0b53049727f213234e4e03

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e5f744b49d70a8d418f1bc6fd0c128fa
guid: 461182bc375cc354bbb3e45db52bdf3f
folderAsset: yes
DefaultImporter:
externalObjects: {}