Unity Package Structure (0.1.0)

This commit is contained in:
Syntriax 2022-12-16 23:24:02 +03:00
parent 8ee5c680f5
commit 7d409495b1
18 changed files with 66 additions and 10 deletions

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 341c2035d0254344cad44ff6138adf58
guid: c9bc11e81e88c784c95a3478b5e2ed52
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -6,12 +6,15 @@ namespace Syntriax.Modules.Action
{
public abstract class ActionBase : MonoBehaviour, IAction
{
public IToggleState ToggleState { get; protected set; } = null;
public IToggleState MemberToggleState { get; protected set; } = null;
public Action<IAction> OnActivated { get; set; } = null;
protected IToggleState toggleState = null;
protected virtual void Awake()
{
ToggleState = new ToggleStateMember(true);
toggleState = GetComponent<IToggleState>();
MemberToggleState = new ToggleStateMember(true);
OnActivated += (_) => OnActionActivated();
}
@ -21,7 +24,7 @@ namespace Syntriax.Modules.Action
protected abstract void OnActionActivated();
public virtual void Activate()
{
if (!ToggleState.IsToggledNullChecked())
if (!MemberToggleState.IsToggledNullChecked() || !toggleState.IsToggledNullChecked())
return;
OnActivated?.Invoke(this);

View File

@ -19,7 +19,7 @@ namespace Syntriax.Modules.Action
protected abstract void OnActionDeactivated();
public virtual void Deactivate()
{
if (!ToggleState.IsToggledNullChecked())
if (!MemberToggleState.IsToggledNullChecked() || !toggleState.IsToggledNullChecked())
return;
OnDeactivated?.Invoke(this);

View File

@ -6,9 +6,9 @@ namespace Syntriax.Modules.Action
public interface IAction
{
/// <summary>
/// The <see cref="IToggleState"/> the Action uses to check if it's active or not
/// The member <see cref="IToggleState"/> the Action uses to check if it's active or not
/// </summary>
IToggleState ToggleState { get; }
IToggleState MemberToggleState { get; }
/// <summary>
/// Called when the <see cref="IAction"/> is Activated

8
Samples.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fae7e0c9773c5434e81df0b2792ec57e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,7 +1,7 @@
using Syntriax.Modules.ToggleState;
using UnityEngine;
namespace Syntriax.Modules.Action
namespace Syntriax.Modules.Action.Samples
{
[RequireComponent(typeof(Rigidbody2D))]
public class PlatformerJump : ActionBaseWithDeactivation
@ -40,7 +40,7 @@ namespace Syntriax.Modules.Action
protected virtual void FixedUpdate()
{
if (!ToggleState.IsToggledNullChecked() || !gameObjectToggleState.IsToggledNullChecked())
if (!MemberToggleState.IsToggledNullChecked() || !gameObjectToggleState.IsToggledNullChecked())
return;
if (rigid.velocity.y < FallThreshold)

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: e45c80df261a5714e9a22fd73a2cd39a
guid: c55e74ac98f03704bb026843c9b84a1e
MonoImporter:
externalObjects: {}
serializedVersion: 2

View File

@ -0,0 +1,17 @@
{
"name": "Syntriax.Modules.Action.Samples",
"rootNamespace": "",
"references": [
"GUID:efa9a9bc94c60c74684aafb7428fbf61",
"GUID:7cd17689338eae84183e6b576fc9ae7c"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ce4428cb56d508648a73c9d80a821fd8
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

14
package.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "com.syntriax.action",
"version": "0.1.0",
"displayName": "Action Module",
"unity": "2019.1",
"documentationUrl": "https://git.syntriax.com/Syntriax/Action.git",
"dependencies": {},
"keywords": ["Action"],
"author": {
"name": "Syntriax",
"email": "Syntriax@gmail.com",
"url": "https://syntriax.com"
}
}

7
package.json.meta Normal file
View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 93b283f7bc30906478f36ce9e596fa9f
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: